Re: ResultSetMetaData.getTableName() - Mailing list pgsql-jdbc

From Jason Davies
Subject Re: ResultSetMetaData.getTableName()
Date
Msg-id 20011124121337.A26080@netspade.com
Whole thread Raw
In response to Re: ResultSetMetaData.getTableName()  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-jdbc
On Sat, Nov 24, 2001 at 01:00:07PM -0500, Tom Lane wrote:
> Jason Davies <jason@netspade.com> writes:
> > Is there any chance ResultSetMetaData.getTableName(int column) could
> > be implemented somehow?
>
> The entire concept seems faulty.  Select results don't come from any
> particular table in the general case, and any tool that expects the
> special case to apply to general queries is broken by design.

True, but the only time a tool would need to know the particular table name is if was going to UPDATE data in one of
thecolumns returned. And this would only be possible for the special cases. 

> You do, of course, know which table the columns came from if you issue a
> query like
>         SELECT * FROM foo
> but you hardly need the backend to tell you so.

Yes, I agree. I guess it would better design to parse the query and check if it is of the "simple" type.

> ISTM that no frontend
> tool should expect to associate particular table names with SELECT
> results except when it knows the query is of such a simple form as this.

Agreed. Thanks for your insight :) It seems there shouldn't be a getTableName at all in the spec because it wouldn't be
usefulmost of the time. Should we put some code into the driver itself to parse the SQL query and check if it is a
simpleSELECT? Also should this be reflected in isWritable() too? 

--
Jason Davies

jason@netspade.com

pgsql-jdbc by date:

Previous
From: Tom Lane
Date:
Subject: Re: ResultSetMetaData.getTableName()
Next
From: Barry Lind
Date:
Subject: Re: "Unable to fathom update count" - what does it mean?