Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id E37CF63253E for ; Tue, 31 Aug 2010 11:47:11 -0300 (ADT) 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 67148-05 for ; Tue, 31 Aug 2010 14:47:02 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 65F596322C4 for ; Tue, 31 Aug 2010 11:47:04 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id o7VEl0GY002684; Tue, 31 Aug 2010 10:47:00 -0400 (EDT) To: Fabien COELHO cc: PostgreSQL Bugs List Subject: Re: issue about information_schema REFERENTIAL_CONSTRAINTS In-reply-to: References: Comments: In-reply-to Fabien COELHO message dated "Tue, 31 Aug 2010 14:03:43 +0200" Date: Tue, 31 Aug 2010 10:46:59 -0400 Message-ID: <2683.1283266019@sss.pgh.pa.us> From: Tom Lane 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: 201008/376 X-Sequence-Number: 27959 Fabien COELHO writes: > The REFERENTIAL_CONSTRAINTS table in the information_schema references a > constaint through its database/schema/name, but this information is not > unique, so it may identify several constraints, thus the information > derived may not be consistent. Postgres does not enforce that constraints have unique names within a schema. The SQL spec does say that they should be unique per-schema, and the information_schema views are designed on that assumption. If you use spec-compliant names for your constraints, you won't have a problem. If you don't, well, the information_schema views will be of limited use to you. > Suggestion: constraint names could be systematically prefixed with their > corresponding table so that they are indeed unique, We are not going to try to enforce uniqueness. This has been debated before, and most people like the current behavior just fine, or at least better than the alternatives. regards, tom lane