Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 40BDFB5DBC2 for ; Wed, 8 Jun 2011 18:43:38 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 60145-02 for ; Wed, 8 Jun 2011 21:43:31 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mailout-de.gmx.net (mailout-de.gmx.net [213.165.64.23]) by mail.postgresql.org (Postfix) with SMTP id A70B1B5D95B for ; Wed, 8 Jun 2011 18:43:30 -0300 (ADT) Received: (qmail invoked by alias); 08 Jun 2011 21:43:29 -0000 Received: from a88-115-218-165.elisa-laajakaista.fi (EHLO [10.0.0.101]) [88.115.218.165] by mail.gmx.net (mp047) with SMTP; 08 Jun 2011 23:43:29 +0200 X-Authenticated: #495269 X-Provags-ID: V01U2FsdGVkX18w4UESlHUwLb08mgGFKTOxQmtNCXOsxXFljRwhlZ yLr7GyJ45GV49b Subject: Re: BUG #5926: information schema dtd_identifier for element_types, columns, parameters views inconsistent From: Peter Eisentraut To: Tom Lane Cc: Susanne Ebrecht , Ingmar Brouns , pgsql-bugs@postgresql.org In-Reply-To: <1307554680.9604.0.camel@vanquo.pezone.net> References: <201103111318.p2BDITcL034900@wwwmaster.postgresql.org> <4DDCE812.10401@2ndQuadrant.com> <9773.1307545767@sss.pgh.pa.us> <1307554680.9604.0.camel@vanquo.pezone.net> Content-Type: text/plain; charset="UTF-8" Date: Thu, 09 Jun 2011 00:43:27 +0300 Message-ID: <1307569407.9604.9.camel@vanquo.pezone.net> Mime-Version: 1.0 X-Mailer: Evolution 2.32.3 Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.909 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201106/89 X-Sequence-Number: 30468 On ons, 2011-06-08 at 20:38 +0300, Peter Eisentraut wrote: > On ons, 2011-06-08 at 11:09 -0400, Tom Lane wrote: > > The omission of collection_type_identifier from the docs is clearly a > > doc bug. However, it looks to me like you've identified an error in the > > view definition, not only a doc bug. I think the values of the > > dtd_identifier and collection_type_identifier columns are swapped, ie, > > we ought to be prepending 'a' to the collection_type_identifier not the > > dtd_identifier. As far as I can tell from the spec, dtd_identifier > > ought to be the identifier of the element type, while > > collection_type_identifier should be a made-up identifier for the array > > type. That would make the sample query given in the docs correct. > > Yes, we need to switch those two columns around and change the > documentation. > > > If my analysis is correct, we really ought to try to fix this in time > > for beta2, since there's no way to fix it without a forced initdb. > > I can take care of this later today. On fifth reading, I think the implementation of the information schema is correct, but the documentation is wrong. It was broken in commit 8e1ccad5: commit 8e1ccad51901e83916dae297cd9afa450957a36c Author: Bruce Momjian Date: Tue Feb 20 18:47:25 2007 +0000 Update information_schema documentation to match system tables. Backpatch to 8.2.X. diff --git a/doc/src/sgml/information_schema.sgml b/doc/src/sgml/information_schema.sgml index 67ce709..8d0b8e4 100644 --- a/doc/src/sgml/information_schema.sgml +++ b/doc/src/sgml/information_schema.sgml @@ -1,4 +1,4 @@ - + The Information Schema @@ -1876,7 +1876,7 @@ SELECT c.column_name, c.data_type, e.data_type AS element_type FROM information_schema.columns c LEFT JOIN information_schema.element_types e ON ((c.table_catalog, c.table_schema, c.table_name, 'TABLE', c.dtd_identifier) - = (e.object_catalog, e.object_schema, e.object_name, e.object_type, e.array_type_identifier)) + = (e.object_catalog, e.object_schema, e.object_name, e.object_type, e.dtd_identifier)) WHERE c.table_schema = '...' AND c.table_name = '...' ORDER BY c.ordinal_position; @@ -1936,13 +1936,11 @@ ORDER BY c.ordinal_position; - array_type_identifier + dtd_identifier sql_identifier The identifier of the data type descriptor of the array being - described. Use this to join with the - dtd_identifier columns of other information - schema views. + described @@ -2097,13 +2095,6 @@ ORDER BY c.ordinal_position; Always null, because arrays always have unlimited maximum cardinality in PostgreSQL - - dtd_identifier - sql_identifier - - An identifier of the data type descriptor of the element. This - is currently not useful. - This needs to be reverted and array_type_identifier (the SQL:1999 name) updated to collection_type_identifier.