Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 8BB5C9FA594 for ; Thu, 4 Jan 2007 18:32:52 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 83510-06 for ; Thu, 4 Jan 2007 18:32:45 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mail63.csoft.net (mail63.csoft.net [205.205.214.4]) by postgresql.org (Postfix) with ESMTP id D674F9FA589 for ; Thu, 4 Jan 2007 18:32:44 -0400 (AST) Received: by mail63.csoft.net (Postfix, from userid 1112) id 0B487F1DB; Thu, 4 Jan 2007 17:32:43 -0500 (EST) Date: Thu, 4 Jan 2007 17:32:43 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary2.csoft.net To: Ken Johanson cc: pgsql-jdbc@postgresql.org, Tom Lane Subject: Re: Support for DatabaseMetadata: getCatalogName, getTableName, In-Reply-To: <459D7D66.6010202@kensystem.com> Message-ID: References: <4594B16C.5010609@kensystem.com> <3936D281-E235-4FB3-889E-08981ABB0954@fastcrypt.com> <459D3487.6080202@kensystem.com> <459D3F3E.5040006@kensystem.com> <459D6CEC.9040505@kensystem.com> <459D7D66.6010202@kensystem.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/32 X-Sequence-Number: 16397 On Thu, 4 Jan 2007, Ken Johanson wrote: >> Right now we don't have the information to return "d" and so we must >> always return the empty string. Getting the base column and table names >> seems more useful but does not appear to be what the javadoc and spec >> imply as the behavior of the standard API methods. >> > > So to be sure, this (literal and alias name differentiation) actually is not > being provided via the current server V3 protocol or server? What we get now in the V3 protocol: 1) the column name which may be an alias but we don't know if it came from an alias or not, consider SELECT a AS a. If we get "a" we don't know if it was aliased or not. 2) The underlying table's oid which can be used to lookup it's name and schema. 3) The underlying column's number in the table which can be used to lookup its name. No information on a table alias is available. > If so, does anyone know off hand if V3 is somehow extensible; i.e can we add > in metadata without breaking apps or major version? > No the RowDescription message is fixed: http://www.postgresql.org/docs/current/static/protocol-message-formats.html > Again, just trying to get an idea of how near or far off this may be. I think > there are several high level object persistence wrappers out there that > depend (right or wrong) on table names/aliases to reconstitute objects from > selects and natural/inner joins. > It's a ways off and even if it was working you have to think about things like self joins and calculated results. What can a tool do with these? SELECT t1.col, t2.col, 1+3 FROM tab t1, tab t2 WHERE t1.a = t2.b; And app would need some serious smarts to unravel this sort of thing. Kris Jurka