Re: information_schema.constraint_column_usage shows wrong table name

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Alex Zeng <Alex(dot)Zeng(at)datam(dot)co(dot)nz>
Cc: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: information_schema.constraint_column_usage shows wrong table name
Date: 2021-08-10 03:17:59
Message-ID: CAKFQuwZ3Rcvka+7fLtCY8nEmNCPQgcXtNzTorLUwde07tODtWA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Aug 9, 2021 at 8:12 PM Alex Zeng <Alex(dot)Zeng(at)datam(dot)co(dot)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.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Amit Kapila 2021-08-10 04:21:12 Re: Issue with logical replication
Previous Message Alex Zeng 2021-08-10 02:57:00 information_schema.constraint_column_usage shows wrong table name