X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8C1045E484A for ; Mon, 6 Sep 2004 03:13:58 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17334-03 for ; Mon, 6 Sep 2004 02:13:57 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 6D06A5E4885 for ; Mon, 6 Sep 2004 03:13:54 +0100 (BST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i862DvB8003725; Sun, 5 Sep 2004 22:13:58 -0400 (EDT) To: Stephan Szabo Cc: Troels Arvin , pgsql-sql@postgresql.org Subject: Re: INFORMATION_SCHEMA and foreign keys In-reply-to: <20040905162116.K38304@megazone.bigpanda.com> References: <20040905162116.K38304@megazone.bigpanda.com> Comments: In-reply-to Stephan Szabo message dated "Sun, 05 Sep 2004 16:29:58 -0700" Date: Sun, 05 Sep 2004 22:13:57 -0400 Message-ID: <3724.1094436837@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200409/35 X-Sequence-Number: 18881 Stephan Szabo writes: > On Mon, 6 Sep 2004, Troels Arvin wrote: >> Is my only way forward to drop using the INFORMATION_SCHEMA and work with >> the pg_catalog if I want to determine which columns are being referred to >> in a (set of) foreign key column(s)? > Possibly, yes. You'd be better off if you named your constraints rather > than letting the system name them for you, but in general you can't rely > on someone else doing that. This is a side effect of allowing table > unique constraint names rather than schema unique constraint names (as a > side note you would need to constrain schema in those joins even if we > did schema unique names). FWIW, the default constraint name creation rules have been rejiggered in 8.0 so that it's much more likely that generated names will be unique schema-wide (see ChooseConstraintName). But we do not make any attempt to positively guarantee this --- in particular, the user can still pick nonunique constraint names, and databases reloaded from existing dumps are likely to still have lots of "$1" etc. regards, tom lane