Re: Two questions about "pg_constraint" - Mailing list pgsql-general

From Tom Lane
Subject Re: Two questions about "pg_constraint"
Date
Msg-id 1161776.1661374651@sss.pgh.pa.us
Whole thread Raw
In response to Two questions about "pg_constraint"  (Bryn Llewellyn <bryn@yugabyte.com>)
Responses Re: Two questions about "pg_constraint"
List pgsql-general
Bryn Llewellyn <bryn@yugabyte.com> writes:
> *Question 1: why does "pg_constraint" have a "connamespace" column?*

You appear to be assuming that every pg_constraint entry is tied to
a table.  This isn't so.

(1) That catalog also carries check constraints for domains, which
are tied to types instead.  Yeah, you could imagine some rule like
"look in either pg_class or pg_type to find the schema", but it'd
be really painful.

(2) The SQL standard describes "assertions", which are global
check constraints that can affect multiple tables.  We don't
support those, and very possibly never will, but the pg_constraint
catalog is set up to support them.  Presumably they'd be stored
with conrelid and contypid both zero, so there would be no other
place to find out the assertion's schema.

I'm not entirely convinced that putting these two (or three) sorts
of objects in the same catalog was a great design.  However, that's
what we've got and changing it seems like more trouble than it'd be
worth.

            regards, tom lane



pgsql-general by date:

Previous
From: Bryn Llewellyn
Date:
Subject: Re: Two questions about "pg_constraint"
Next
From: Hillary Masha
Date:
Subject: Re: Corrupted Postgresql Microsoft Binaries