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

this occurs on postgresql 17.2 and did not occur on any previous version including 16, 15, 14.   apologies if this has
alreadybeen 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"





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


$ 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.

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
hasalready been reported but I didn't see any means of looking up existing issues 
>

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



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
hasalready 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&id=6e793582bc663fb7652834170be8902b982b7bcb



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.

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




"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




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