1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-18 17:41:14 +03:00

Fix constraint_column_usage for foreign keys.

This commit is contained in:
Peter Eisentraut 2003-12-16 14:56:34 +00:00
parent 655eb600de
commit 0b00d7cd4a

View File

@ -4,7 +4,7 @@
* *
* Copyright 2003, PostgreSQL Global Development Group * Copyright 2003, PostgreSQL Global Development Group
* *
* $Id: information_schema.sql,v 1.15.2.3 2003/12/07 19:43:13 tgl Exp $ * $Id: information_schema.sql,v 1.15.2.4 2003/12/16 14:56:34 petere Exp $
*/ */
/* /*
@ -445,10 +445,9 @@ CREATE VIEW constraint_column_usage AS
pg_constraint c, _pg_keypositions() AS pos(n) pg_constraint c, _pg_keypositions() AS pos(n)
WHERE nr.oid = r.relnamespace WHERE nr.oid = r.relnamespace
AND r.oid = a.attrelid AND r.oid = a.attrelid
AND r.oid = c.conrelid
AND nc.oid = c.connamespace AND nc.oid = c.connamespace
AND (CASE WHEN c.contype = 'f' THEN c.confkey[pos.n] = a.attnum AND (CASE WHEN c.contype = 'f' THEN r.oid = c.confrelid AND c.confkey[pos.n] = a.attnum
ELSE c.conkey[pos.n] = a.attnum END) ELSE r.oid = c.conrelid AND c.conkey[pos.n] = a.attnum END)
AND a.attnum > 0 AND a.attnum > 0
AND NOT a.attisdropped AND NOT a.attisdropped
AND c.contype IN ('p', 'u', 'f') AND c.contype IN ('p', 'u', 'f')