X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0440252809 for ; Tue, 9 Aug 2005 20:16:14 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00331-08 for ; Tue, 9 Aug 2005 23:16:05 +0000 (GMT) Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.193]) by svr1.postgresql.org (Postfix) with ESMTP id D59C652823 for ; Tue, 9 Aug 2005 20:16:03 -0300 (ADT) Received: by nproxy.gmail.com with SMTP id c2so2532nfe for ; Tue, 09 Aug 2005 16:16:06 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=mop0kx8JGa3TdJodH9+TrIaR1wc4D37vsd1jjspmTcsmg0lMhM9NRFkVEGA/P2S4QC2NeD8wqOIzYDgl0PEfKE6Keh7dAKaz+dvRDoR3ZxSHqyk7VKy3l9Ppb0nBTfAa3OjOHOotPsuOErjoP1CiNq6RoyAl4hKyOX4J6WyyLZc= Received: by 10.48.143.9 with SMTP id q9mr3475nfd; Tue, 09 Aug 2005 16:16:06 -0700 (PDT) Received: by 10.48.249.2 with HTTP; Tue, 9 Aug 2005 16:16:06 -0700 (PDT) Message-ID: <224f323405080916162cd2f75a@mail.gmail.com> Date: Wed, 10 Aug 2005 01:16:06 +0200 From: Thomas Dudziak To: pgsql-jdbc@postgresql.org Subject: Re: Missing functionality in ResultSetMetaData ? In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <224f323405080913385a38ece0@mail.gmail.com> <224f323405080914194be16ac3@mail.gmail.com> <224f3234050809153725fb91c@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200508/58 X-Sequence-Number: 13627 On 8/10/05, Kris Jurka wrote: > The issue actually started with column names. The pg server currently ca= n > return aliases for columns, but not for tables. The original complaint > was that RSMD.getColumnName better match up with something if we call > ResultSet.findColumn with it. After much discussion it was agreed that > getColumnName means the name of the query's result column not the base > table's column. Now, to be consistent getTableName must mean the query's > table as well. Ah, ok, I understand this. =20 > This isn't completely useless, consider a self join: "SELECT a.c, > b.c FROM tab a, tab b". getBaseTableName cannot distinguish this, but if > getTableName did return the alias it could. This isn't a real strong > use case though... > > "The method PreparedStatement.getMetaData retrieves a > > ResultSetMetaData object containing a description of the columns that w= ill be > > returned by a prepared statement when is it executed. The ResultSetMeta= Data > > object contains a record for each column being returned. Methods in the > > ResultSetMetaData interface provide information about the number of col= umns > > being returned and the characteristics of each column." > > > > Here they specifically speak about the column' characteristics (ie. > > definition) not the query. >=20 > That's not entirely clear. That's how you read it, but it is just as > easily read as "the query result's columns". The spec is awfully vague i= n > this area. Yep, that's the problem. Interestingly, the Javadoc for RSMD.getCatalogName= says "Gets the designated column's table's catalog name" where the Javadoc for getTableName says "Gets the designated column's table name." So, taken together this could be interpreted as meaning the structural info (real table). But as you said, this is guess work. Perhaps you could write a comment to the JDBC4 JSR group and ask for clarification of the semantics of the RSMD in the new spec ? regards, Tom