Alex Zeng <Alex.Zeng@datam.co.nz> writes:
> 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
wecan have a constraint from table C to B and they will have same value in information_schema.constraint_column_usage.
The SQL standard says the purpose of this view is to
Identify the columns used by referential constraints, unique
constraints, check constraints, and assertions defined in this catalog
and owned by a given user or role.
so I think the view is showing the column name it is supposed to,
ie the referenced column name not the referencing column name.
The key_column_usage view might help you with the other thing.
regards, tom lane