Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 17B809F95EF for ; Mon, 27 Aug 2007 06:05:11 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 44821-02 for ; Mon, 27 Aug 2007 06:05:05 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from mail.ukfsn.org (s2.ukfsn.org [217.158.120.143]) by postgresql.org (Postfix) with ESMTP id D85B49F95DE for ; Mon, 27 Aug 2007 06:05:05 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mail.ukfsn.org (Postfix) with ESMTP id C85A7DF51A for ; Mon, 27 Aug 2007 10:05:23 +0100 (BST) Received: from mail.ukfsn.org ([127.0.0.1]) by localhost (smtp-filter.ukfsn.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BzbrEQsbqUTR for ; Mon, 27 Aug 2007 10:05:23 +0100 (BST) Received: from stargate (84-45-236-142.no-dns-yet.enta.net [84.45.236.142]) by mail.ukfsn.org (Postfix) with ESMTP id 78995DF519 for ; Mon, 27 Aug 2007 10:05:23 +0100 (BST) From: David Goodenough To: pgsql-jdbc@postgresql.org Subject: Re: Support for ResultSetMetaData.getTableName Date: Mon, 27 Aug 2007 10:04:48 +0100 User-Agent: KMail/1.9.7 References: <200708211506.22384.david.goodenough@btconnect.com> <13835.1188192676@sss.pgh.pa.us> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200708271004.49945.david.goodenough@btconnect.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.197 tagged_above=0 required=5 tests=AWL=0.937, BAYES_20=-0.74 X-Spam-Level: X-Archive-Number: 200708/96 X-Sequence-Number: 17409 On Monday 27 August 2007, Kris Jurka wrote: > On Mon, 27 Aug 2007, Tom Lane wrote: > > I suggest that the following mapping might be more sensible: > > > > getColumnName returns "a" > > getTableName returns "c" > > getSchemaName returns name of c's schema > > getColumnLabel returns "b" > > > > where the first three fail if the SELECT column isn't a simple column > > reference, but getColumnLabel always works. > > I tried that back here: > > http://archives.postgresql.org/pgsql-jdbc/2004-07/threads.php#00314 > > and continuing here: > > http://archives.postgresql.org/pgsql-jdbc/2004-08/threads.php#00008 > > This message demonstrates that many other drivers do Column Name/Label in > a different way: > > http://archives.postgresql.org/pgsql-jdbc/2004-08/msg00012.php > > So while I agree with you that the above suggestions make sense from a > blank slate, we can't do this without causing problems. It seems people > would like us to fallback from our position of table and schema returning > aliases, which while inconsistent, is certainly more useful at this point > in time. > > Kris Jurka I have to admit that the thought of returning an alias name for a table had not occurred to me, what I need is the c. My need for it is using something like sql2java, when I have a constructed bean for each record. When I do a select that picks values from multiple tables I would like to populate the beans with the relevant values from the resultset. I would like this to be generic code rather than having to tell each bean which fields to pick. For this purpose encoding the table from which the bean comes in the bean (or its corresponding manager class) is easy, the alias an an artifact of the select. David