pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kris Jurka <books@ejurka.com>
Cc: David Goodenough <david.goodenough@btconnect.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Support for ResultSetMetaData.getTableName
Date: Mon, 27 Aug 2007 01:31:16 -0400
Message-ID: <13835.1188192676@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.BSO.4.64.0708270055230.23186@leary.csoft.net>
References: <200708211506.22384.david.goodenough@btconnect.com>
	<Pine.BSO.4.64.0708270055230.23186@leary.csoft.net>

Kris Jurka <books@ejurka.com> writes:
> The discussion was focused on the ability of the server to return the 
> alias of a table as well as the base table name.  Because getColumnName 
> will return "b" for "SELECT a AS b FROM c AS d" we have decided that 
> getTableName should return "d" instead of "c".

[ itch... ]  Just looking at this again, I wonder whether that's going
in the wrong direction.  What is the point of getTableName, if not to
find out a table name that is usable in other queries?  I also notice
that the spec provides getSchemaName, which is sensible if one supposes
that the point of all this is to find out the actual table name, and is
completely nonsensical if the point is to find out the inherently
not-schema-qualified table alias.

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'm not sure what the use-case is for finding out "d".

			regards, tom lane



view thread (5+ messages)  latest in thread

Message-ID: <13835.1188192676@sss.pgh.pa.us>
Permalink:  ../13835.1188192676@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/13835.1188192676@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: tgl@sss.pgh.pa.us, books@ejurka.com, david.goodenough@btconnect.com
  Subject: Re: Support for ResultSetMetaData.getTableName
  In-Reply-To: <13835.1188192676@sss.pgh.pa.us>
  References: <200708211506.22384.david.goodenough@btconnect.com> <Pine.BSO.4.64.0708270055230.23186@leary.csoft.net> <13835.1188192676@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox