Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 0CA731337BB9 for ; Sat, 19 Feb 2011 19:22:20 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 23582-01 for ; Sat, 19 Feb 2011 23:22:13 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from momjian.us (momjian.us [70.90.9.53]) by mail.postgresql.org (Postfix) with ESMTP id 5AF3B1337990 for ; Sat, 19 Feb 2011 19:22:12 -0400 (AST) Received: (from bruce@localhost) by momjian.us (8.11.6/8.11.6) id p1JNMBx26553; Sat, 19 Feb 2011 18:22:11 -0500 (EST) From: Bruce Momjian Message-Id: <201102192322.p1JNMBx26553@momjian.us> Subject: Re: issue about information_schema REFERENTIAL_CONSTRAINTS In-Reply-To: To: Fabien COELHO Date: Sat, 19 Feb 2011 18:22:11 -0500 (EST) CC: Kevin Grittner , PostgreSQL Bugs List X-Mailer: ELM [version 2.4ME+ PL124 (25)] MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="ELM1298157731-27446-0_" Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201102/171 X-Sequence-Number: 29443 --ELM1298157731-27446-0_ Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="US-ASCII" Fabien COELHO wrote: > > > If you're going to use something which is PostgreSQL-specific, you may > > as well write your own views or use the "native" tables and views > > directly. > > I wish I could write portable code, if possible:-) > > I'm basically writing views on top of the information_schema under the > assumption that what is expected to be a key is a key. The information > schema is *useless* otherwise as wrong tuples are built on join, and > derived information is not reliable. > > I guess I must the only actual user of the information_schema, and it will > soon be back to zero user, which will be fine from the developers point of > view. Based on this report and later discussion, I have applied the attached documentation patch to warn users about the Postgres behavior of information_schema.referential_constraints. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + It's impossible for everything to be true. + --ELM1298157731-27446-0_ Content-Transfer-Encoding: 7bit Content-Type: text/x-diff Content-Disposition: inline; filename="/rtmp/constraint.diff" diff --git a/doc/src/sgml/information_schema.sgml b/doc/src/sgml/information_schema.sgml index 52407a7..91c2dd4 100644 *** a/doc/src/sgml/information_schema.sgml --- b/doc/src/sgml/information_schema.sgml *************** ORDER BY c.ordinal_position; *** 3211,3216 **** --- 3211,3229 ---- + + + + The SQL standard requires constraint names to be unique within a + schema; PostgreSQL, however, does not + enforce this restriction. If duplicate-named constraints are + stored in the same PostgreSQL schema, a + standard-compliant query that expects to return one row might + return several, one for each matching constraint stored in the + specified schema. + + + --ELM1298157731-27446-0_--