Re: Function pg_get_constraintdef
Magnus Hagander <magnus@hagander.net>
From: Magnus Hagander <magnus@hagander.net>
To: Erki Eessaar <erki.eessaar@taltech.ee>
Cc: "pgsql-bugs@lists.postgresql.org" <pgsql-bugs@lists.postgresql.org>, Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: 2024-11-21T12:16:45Z
Lists: pgsql-bugs
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix pg_get_constraintdef for NOT NULL constraints on domains
- 6e793582bc66 17.3 landed
- 09d09d4297b9 18.0 landed
On Thu, Nov 21, 2024 at 1:01 PM Erki Eessaar <erki.eessaar@taltech.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/>