While the information_schema is useful, there is no substitute for learning how to use the pg_catalog and system information functions.
See if this query gives you what you are looking for:
SELECT rel.relname, con.conname, con.contype, con.consrc, pg_get_constraintdef(con.oid, true) FROM pg_class rel JOIN pg_constraint con ON (con.conrelid = rel.oid) ORDER by relname, contype, conname;
On Tue, Aug 22, 2017 at 12:42 PM, Igor Korot <ikorot01@gmail.com> wrote:
There are 3 foreign keys in this table for which there are 4 rows displayed in my query as it should be:
1 for leagues(id) 1 for scorehits(scoreid) 2 for playersinleague(id,playerid) - 1 row per field
However what I would expect to see is:
[code] ordinal_position | position_in_unique_constraint 0 1 - this is for leagues(id) 1 1 1 2 - those 2 are for playersinleague(id,playerid) 2 1 - this is for scorehits(scoreid) [/code]
Instead I got ordinal_positionv = position_in_unique_constraints and can't tell which constraint is which, or more precisely, when the one ends and second starts.
Hopefully this above will not be mangled and the spacing will be kept.