Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id F19DC6330BC for ; Fri, 3 Sep 2010 09:08:47 -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 16487-01 for ; Fri, 3 Sep 2010 12:08:39 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from cascavel.ensmp.fr (cascavel.ensmp.fr [194.214.158.227]) by mail.postgresql.org (Postfix) with ESMTP id BAE6D633093 for ; Fri, 3 Sep 2010 09:08:40 -0300 (ADT) Received: from cri.ensmp.fr (adsl.cri.pck.nerim.net [213.41.242.111]) (authenticated bits=0) by cascavel.ensmp.fr (8.14.3/8.14.3/JMMC-11/Mar/2010) with ESMTP id o83C8aWO015500 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 3 Sep 2010 14:08:37 +0200 (MEST) Date: Fri, 3 Sep 2010 14:08:36 +0200 (CEST) From: Fabien COELHO X-X-Sender: fabien@localhost.localdomain Reply-To: Fabien COELHO To: Tom Lane cc: Peter Eisentraut , PostgreSQL Bugs List Subject: Re: issue about information_schema REFERENTIAL_CONSTRAINTS In-Reply-To: <6462.1283454730@sss.pgh.pa.us> Message-ID: References: <2683.1283266019@sss.pgh.pa.us> <1283369900.15386.0.camel@vanquo.pezone.net> <1283438419.23199.0.camel@vanquo.pezone.net> <6462.1283454730@sss.pgh.pa.us> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Miltered: at cascavel with ID 4C80E544.000 by Joe's j-chkmail (http : // j-chkmail dot ensmp dot fr)! X-j-chkmail-Enveloppe: 4C80E544.000 from adsl.cri.pck.nerim.net/adsl.cri.pck.nerim.net/213.41.242.111/cri.ensmp.fr/ X-Scores-Stats: 4C80E544.000 B=0.02607 L=0.21999 G=0.00749 Agree X-j-chkmail-Score: MSGID : 4C80E544.000 on cascavel.ensmp.fr : j-chkmail score : . : R=. U=. O=. B=0.007 -> S=0.007 X-j-chkmail-Status: Ham 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: 201009/24 X-Sequence-Number: 27988 Dear Tom, Still for the sake of argument: > Note that (2) fails for long names; you have to do something to > compress to NAMEDATALEN. Indeed. What if the type is changed to TEXT? It is just a view after all. How important is it to stick to "sql_identifier"? > The big problem with either of these is that it's no longer easily > possible to extract the actual constraint name from the view. Sure. A function is provided to do so, say information_schema_constraint_name_to_pg_constraint_name. > In any case, I am fairly sure that not having the constraint_name column > show the actual constraint name is a violation of the spirit of the SQL > spec, whether or not you can claim that it meets the letter. Well, one must choose between to evil: (1) the constraint_name is changed in the view to be unique as expected by the spec, and the data can be joined meaningfully, and some reliable information can be derived. (2) the constraint_name looks nice but is not unique, and the information in the view is ambiguous and cannot be relied upon, so one is back to square "postgresql supports the information_schema, but there is no point to query it and expecting the results to reflect the contents of the catalogs". If you want to stick to both the letter and the spirit of the spec, that would mean enforcing unique constraint names in pg and break every applications. Not good. ISTM that the "spirit" of the information schema is more to be useful (1) than to look beautiful (2). Another technical proposal, a little more subtle and with possible underlying issues I cannot foresee: have the constraint_name be a "pair of sql_identifiers". -- Fabien.