Re: [GENERAL] Why am I getting doubles?

2017-07-27 Thread Tom Lane
Igor Korot writes: > Is there a reason I'm seeing duplicate records on the query above? Your example isn't complete, but I think the problem is your WHERE clause isn't equating enough columns. For instance, if I do db=# create table pp(f1 int, f2 int, primary key (f1,f2)); CREATE TABLE that pr

[GENERAL] Why am I getting doubles?

2017-07-27 Thread Igor Korot
Hi, The query below should get foreign keys for a specific table: draft=# SELECT DISTINCT kcu.ordinal_position AS ordinal, kcu.position_in_unique_constraint AS position, tc.constraint_name AS name, tc.constraint_schema AS schema, tc.table_name AS table, kcu.column_name AS column, ccu.table_name AS