Hi Szabolcs, I haven't been able to reproduce, though there may be some code inefficiency allowing wrong output you are experiencing. Could you possibly try to run the following SELECT to see what output you get from your db? Just replace 'postgres' schema with your one in WHERE clause. SELECT b.attname AS column_name, b.relname AS table_name, c.conname FROM (SELECT a.attname, t.relname, a.attnum, t.oid FROM pg_attribute a, pg_class t, pg_namespace s, pg_type x WHERE t.relnamespace = s.oid AND s.nspname = 'postgres' AND (t.relkind = 'r' OR t.relkind = 'v') AND a.attrelid = t.oid AND a.atttypid = x.oid AND a.attnum 0) b LEFT JOIN pg_constraint c ON c.conrelid = b.oid AND b.attnum = ANY (c.conkey) AND c.contype = 'p' WHERE b.relname = 'sample_view' In my case, I get the following output. Thank you! Lukas
↧