pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Philip Yarra <philip@utiba.com>
To: Oliver Jowett <oliver@opencloud.com>
Cc: Alex Stienstra <alex.stienstra@zonnet.nl>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: ResultSetMetaData.getTableName() == null
Date: Fri, 22 Sep 2006 16:04:36 +1000
Message-ID: <45137CF4.7030202@utiba.com> (raw)
In-Reply-To: <45137742.9050600@opencloud.com>
References: <20060921121816.9wvu8sr34w5c4848@webmail.versatel.nl>
	<45133DE5.4030100@utiba.com>
	<451354B5.2070701@opencloud.com>
	<45135D9B.50500@utiba.com>
	<45135EE2.6020507@opencloud.com>
	<4513727F.10107@utiba.com>
	<45137742.9050600@opencloud.com>

Oliver Jowett wrote:
> Philip Yarra wrote:
> So your suggested implementation would return incorrect information 
> whenever there were aliases involved.

Thanks, I understand now. So the decision was to return nothing, rather 
than something that's potentially wrong?

> We have no way of telling if aliasing has been done or not based on the 
> data returned by the server, so we can't even do it only when no aliases 
> are used.

Looks like Sybase came to the same question and decided that returning 
the base table name was ok:

$ java -cp .:/home/philip/bin/jconn3.jar rsmd sybase3.prop
2006-09-22T15:50:39.206:QUERY: SELECT * FROM tempextest
2006-09-22T15:50:39.210:table name [tempextest]
2006-09-22T15:50:39.212:QUERY: SELECT * FROM tempextest tablealias
2006-09-22T15:50:39.215:table name [tempextest]

Oracle seems to have a very similar implementation to PostgreSQL:

$ java -cp .:/home/philip/bin/ojdbc14.jar rsmd oracle.prop
2006-09-22T15:53:59.882:QUERY: SELECT * FROM tempextest
2006-09-22T15:53:59.986:empty table name
2006-09-22T15:53:59.987:table name []
2006-09-22T15:53:59.989:QUERY: SELECT * FROM tempextest tablealias
2006-09-22T15:54:00.3:empty table name
2006-09-22T15:54:00.4:table name []

How about allowing the user to set a connection property so that the 
(possibly-wrong-but-more-useful) call through to getbaseTablename is 
done, so that *some* info comes back, with default of existing 
behaviour? Or has that also been discussed and dismissed previously? :-)

Regards, Philip.

-- 
Philip Yarra
Senior Software Engineer, Utiba Pty Ltd
philip@utiba.com



view thread (13+ messages)  latest in thread

Message-ID: <45137CF4.7030202@utiba.com>
Permalink:  ../45137CF4.7030202@utiba.com/
Also on:    postgresql.org/message-id/45137CF4.7030202@utiba.com

 · 

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: philip@utiba.com, oliver@opencloud.com, alex.stienstra@zonnet.nl
  Subject: Re: ResultSetMetaData.getTableName() == null
  In-Reply-To: <45137CF4.7030202@utiba.com>
  References: <20060921121816.9wvu8sr34w5c4848@webmail.versatel.nl> <45133DE5.4030100@utiba.com> <451354B5.2070701@opencloud.com> <45135D9B.50500@utiba.com> <45135EE2.6020507@opencloud.com> <4513727F.10107@utiba.com> <45137742.9050600@opencloud.com> <45137CF4.7030202@utiba.com>

* 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