invalid constraint type "n" when using pg_catalog.pg_get_constraintdef() on pg17, regression from pg16

Started by Mike Bayerover 1 year ago8 messagesbugs
Jump to latest
#1Mike Bayer
mike_mp@zzzcomputing.com

this occurs on postgresql 17.2 and did not occur on any previous version including 16, 15, 14. apologies if this has already been reported but I didn't see any means of looking up existing issues

complete steps below

$ psql -U scott -h pg17 test
Password for user scott:
psql (16.3, server 17.2)
WARNING: psql major version 16, server major version 17.
Some psql features might not work.
Type "help" for help.

test=> CREATE DOMAIN not_nullable_domain AS TEXT NOT NULL;
CREATE DOMAIN
test=> SELECT
domain_constraints.condefs, domain_constraints.connames, pg_catalog.pg_collation.collname
FROM pg_catalog.pg_type
JOIN pg_catalog.pg_namespace ON pg_catalog.pg_namespace.oid = pg_catalog.pg_type.typnamespace
LEFT OUTER JOIN pg_catalog.pg_collation ON pg_catalog.pg_type.typcollation = pg_catalog.pg_collation.oid
LEFT OUTER JOIN
(SELECT pg_catalog.pg_constraint.contypid AS contypid,
array_agg(pg_catalog.pg_get_constraintdef(pg_catalog.pg_constraint.oid, true)) AS condefs,
array_agg(CAST(pg_catalog.pg_constraint.conname AS TEXT)) AS connames
FROM pg_catalog.pg_constraint
WHERE pg_catalog.pg_constraint.contypid != 0
GROUP BY pg_catalog.pg_constraint.contypid) AS domain_constraints ON pg_catalog.pg_type.oid = domain_constraints.contypid
WHERE pg_catalog.pg_type.typtype = 'd' ORDER BY pg_catalog.pg_namespace.nspname, pg_catalog.pg_type.typname;
ERROR: invalid constraint type "n"

#2David G. Johnston
david.g.johnston@gmail.com
In reply to: Mike Bayer (#1)
Re: invalid constraint type "n" when using pg_catalog.pg_get_constraintdef() on pg17, regression from pg16

On Thursday, December 12, 2024, Mike Bayer <mike_mp@zzzcomputing.com> wrote:

this occurs on postgresql 17.2 and did not occur on any previous version
including 16, 15, 14. apologies if this has already been reported but I
didn't see any means of looking up existing issues

https://www.postgresql.org/search/?m=1

$ psql -U scott -h pg17 test

Password for user scott:
psql (16.3, server 17.2)
WARNING: psql major version 16, server major version 17.
Some psql features might not work.

This is apparently just such a feature…

David J.

#3jian he
jian.universality@gmail.com
In reply to: Mike Bayer (#1)
Re: invalid constraint type "n" when using pg_catalog.pg_get_constraintdef() on pg17, regression from pg16

On Thu, Dec 12, 2024 at 10:09 PM Mike Bayer <mike_mp@zzzcomputing.com> wrote:

this occurs on postgresql 17.2 and did not occur on any previous version including 16, 15, 14. apologies if this has already been reported but I didn't see any means of looking up existing issues

https://git.postgresql.org/cgit/postgresql.git/commit/?id=09d09d4297b9acbc2848ec35e8bf030d6c1fae18

#4jian he
jian.universality@gmail.com
In reply to: jian he (#3)
Re: invalid constraint type "n" when using pg_catalog.pg_get_constraintdef() on pg17, regression from pg16

On Thu, Dec 12, 2024 at 10:27 PM jian he <jian.universality@gmail.com> wrote:

On Thu, Dec 12, 2024 at 10:09 PM Mike Bayer <mike_mp@zzzcomputing.com> wrote:

this occurs on postgresql 17.2 and did not occur on any previous version including 16, 15, 14. apologies if this has already been reported but I didn't see any means of looking up existing issues

https://git.postgresql.org/cgit/postgresql.git/commit/?id=09d09d4297b9acbc2848ec35e8bf030d6c1fae18

sorry. This link is for master.

it was fixed.
the correct link is
https://git.postgresql.org/cgit/postgresql.git/commit/?h=REL_17_STABLE&amp;id=6e793582bc663fb7652834170be8902b982b7bcb

#5David G. Johnston
david.g.johnston@gmail.com
In reply to: David G. Johnston (#2)
Re: invalid constraint type "n" when using pg_catalog.pg_get_constraintdef() on pg17, regression from pg16

On Thu, Dec 12, 2024 at 7:14 AM David G. Johnston <
david.g.johnston@gmail.com> wrote:

On Thursday, December 12, 2024, Mike Bayer <mike_mp@zzzcomputing.com>
wrote:

$ psql -U scott -h pg17 test
Password for user scott:
psql (16.3, server 17.2)
WARNING: psql major version 16, server major version 17.
Some psql features might not work.

This is apparently just such a feature…

My bad, ignore this, I saw this and ended up thinking the complaint was
against psql, not the server-internals.

David J.

#6Mike Bayer
mike_mp@zzzcomputing.com
In reply to: David G. Johnston (#5)
Re: invalid constraint type "n" when using pg_catalog.pg_get_constraintdef() on pg17, regression from pg16

On Thu, Dec 12, 2024, at 9:37 AM, David G. Johnston wrote:

On Thu, Dec 12, 2024 at 7:14 AM David G. Johnston <david.g.johnston@gmail.com> wrote:

On Thursday, December 12, 2024, Mike Bayer <mike_mp@zzzcomputing.com> wrote:

$ psql -U scott -h pg17 test
Password for user scott:
psql (16.3, server 17.2)
WARNING: psql major version 16, server major version 17.
Some psql features might not work.

This is apparently just such a feature…

My bad, ignore this, I saw this and ended up thinking the complaint was against psql, not the server-internals.

David J.

correct, this is observed using all Python postgresql drivers, I was using psql to make an easy repro

#7Tom Lane
tgl@sss.pgh.pa.us
In reply to: Mike Bayer (#6)
Re: invalid constraint type "n" when using pg_catalog.pg_get_constraintdef() on pg17, regression from pg16

"Mike Bayer" <mike_mp@zzzcomputing.com> writes:

correct, this is observed using all Python postgresql drivers, I was using psql to make an easy repro

As Jian said, this was reported and fixed last month.
(I checked that your example works against v17 branch tip.)
Should appear in 17.3.

regards, tom lane

#8Mike Bayer
mike_mp@zzzcomputing.com
In reply to: Tom Lane (#7)
Re: invalid constraint type "n" when using pg_catalog.pg_get_constraintdef() on pg17, regression from pg16

On Thu, Dec 12, 2024, at 10:48 AM, Tom Lane wrote:

"Mike Bayer" <mike_mp@zzzcomputing.com> writes:

correct, this is observed using all Python postgresql drivers, I was using psql to make an easy repro

As Jian said, this was reported and fixed last month.
(I checked that your example works against v17 branch tip.)
Should appear in 17.3.

regards, tom lane

thanks for double checking!

- mike