Skip to content

Commit 0fb3ec1

Browse files
committed
Fix constraint_column_usage for foreign keys.
1 parent f57832f commit 0fb3ec1

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/backend/catalog/information_schema.sql

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Copyright 2003, PostgreSQL Global Development Group
66
*
7-
* $PostgreSQL: pgsql/src/backend/catalog/information_schema.sql,v 1.19 2003/12/07 19:43:02 tgl Exp $
7+
* $PostgreSQL: pgsql/src/backend/catalog/information_schema.sql,v 1.20 2003/12/16 14:57:20 petere Exp $
88
*/
99

1010
/*
@@ -445,10 +445,9 @@ CREATE VIEW constraint_column_usage AS
445445
pg_constraint c, _pg_keypositions() AS pos(n)
446446
WHERE nr.oid = r.relnamespace
447447
AND r.oid = a.attrelid
448-
AND r.oid = c.conrelid
449448
AND nc.oid = c.connamespace
450-
AND (CASE WHEN c.contype = 'f' THEN c.confkey[pos.n] = a.attnum
451-
ELSE c.conkey[pos.n] = a.attnum END)
449+
AND (CASE WHEN c.contype = 'f' THEN r.oid = c.confrelid AND c.confkey[pos.n] = a.attnum
450+
ELSE r.oid = c.conrelid AND c.conkey[pos.n] = a.attnum END)
452451
AND a.attnum > 0
453452
AND NOT a.attisdropped
454453
AND c.contype IN ('p', 'u', 'f')

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy