Re: Function pg_get_constraintdef

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Erki Eessaar <erki(dot)eessaar(at)taltech(dot)ee>
Cc: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Subject: Re: Function pg_get_constraintdef
Date: 2024-11-21 12:16:45
Message-ID: CABUevEw=ohSx95+Ccdpg438w-3royWqMZxLur-PRQHnXEdHaSQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Nov 21, 2024 at 1:01 PM Erki Eessaar <erki(dot)eessaar(at)taltech(dot)ee>
wrote:

> Hello
>
> SELECT pg_get_constraintdef(c.oid)
> FROM pg_catalog.pg_constraint c;
>
> If I execute the query in two different servers with PostgreSQL 17.1 and
> in different databases in these servers, then I get the answer
>
> ERROR: invalid constraint type "n"
>
> In case of an empty database I do not get the error. The query worked in
> the servers before upgrading to PostgreSQL 17.
>
> If I execute the query in a database of a server with PostgreSQL 15, then
> I do not get the error.
>
>
Looks like this is an omission in the catalog-not-null-constraints patch.
It happens when you've got a domain that has a not null constraint on it.
Easily reproducible with

create domain test as int int not null;
SELECT pg_get_constraintdef(c.oid) FROM pg_catalog.pg_constraint c;

--
Magnus Hagander
Me: https://www.hagander.net/ <http://www.hagander.net/>
Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message radagast42 2024-11-21 12:28:29 AW: Wrong german error message encoding
Previous Message Erki Eessaar 2024-11-21 12:04:04 Re: Function pg_get_constraintdef