Re: information_schema.constraint_column_usage shows wrong table name - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: information_schema.constraint_column_usage shows wrong table name
Date
Msg-id CAKFQuwZ3Rcvka+7fLtCY8nEmNCPQgcXtNzTorLUwde07tODtWA@mail.gmail.com
Whole thread Raw
In response to information_schema.constraint_column_usage shows wrong table name  (Alex Zeng <Alex.Zeng@datam.co.nz>)
List pgsql-bugs
On Mon, Aug 9, 2021 at 8:12 PM Alex Zeng <Alex.Zeng@datam.co.nz> wrote:
When creating a constraint from table A to table B, the table name and column name in information_schema.constraint_column_usage  shows table B. That makes impossible to check whether a constraint exists as we can have a constraint from table C to B and they will have same value in information_schema.constraint_column_usage.

Going from memory here but I believe what you are seeing is a consequence of not following the SQL standard for naming things and then using an SQL standard view to inspect the meta-data.  This is one of the few cases where the flexibility we provide above-and-beyond the SQL standard renders using one of its features problematic.  You will either need to standardize your naming or use the pg_catalog.

David J.

pgsql-bugs by date:

Previous
From: Alex Zeng
Date:
Subject: information_schema.constraint_column_usage shows wrong table name
Next
From: Amit Kapila
Date:
Subject: Re: Issue with logical replication