pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
TableName
4+ messages / 3 participants
[nested] [flat]

* TableName
@ 2012-10-29 15:30  Goran Popov <goran.popov@prokomsoft.rs>
  0 siblings, 2 replies; 4+ messages in thread

From: Goran Popov @ 2012-10-29 15:30 UTC (permalink / raw)
  To: pgsql-jdbc

AbstractJdbc2ResultSetMetaData.java


Whay this is default
  public String getTableName(int column) throws SQLException
     {
         return "";
     }

and not this
  public String getTableName(int column) throws SQLException
     {
         return getBaseTableName(column);
     }




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: TableName
@ 2012-10-29 16:21  dmp <danap@ttc-cmc.net>
  parent: Goran Popov <goran.popov@prokomsoft.rs>
  1 sibling, 1 reply; 4+ messages in thread

From: dmp @ 2012-10-29 16:21 UTC (permalink / raw)
  To: goran.popov@prokomsoft.rs; pgsql-jdbc

Looks like perhasp because it is not applicable for a resultSet.
As per the the Java™ Platform, Standard Edition 6 API Specification.

Interface ResultSetMetaData

String getTableName(int column)
                     throws SQLException

     Gets the designated column's table name.

     Parameters:
         column - the first column is 1, the second is 2, ...
     Returns:
         table name or "" if not applicable
     Throws:
	SQLException - if a database access error occurs

Consider SELECT(1*2) resultSet.
Does that have a table name?

danap.

Goran Popov wrote:
> AbstractJdbc2ResultSetMetaData.java
>
>
> Whay this is default
> public String getTableName(int column) throws SQLException
> {
> return "";
> }
>
> and not this
> public String getTableName(int column) throws SQLException
> {
> return getBaseTableName(column);
> }





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: TableName
@ 2012-10-30 01:49  Kris Jurka <books@ejurka.com>
  parent: Goran Popov <goran.popov@prokomsoft.rs>
  1 sibling, 0 replies; 4+ messages in thread

From: Kris Jurka @ 2012-10-30 01:49 UTC (permalink / raw)
  To: Goran Popov <goran.popov@prokomsoft.rs>; +Cc: pgsql-jdbc



On Mon, 29 Oct 2012, Goran Popov wrote:

> Whay this is default
>  public String getTableName(int column) throws SQLException
>     {
>         return "";
>     }
> 

For symmetry with getColumnName.  Currently getColumnName 
returns the aliased column name so that "SELECT a AS b FROM c 
AS d" returns "b" for getColumnName.  So we'd like to be able 
to return "d" for getTableName, but do not have sufficient 
information to do so, so we return "".

My recollection of previous discussions was that getColumnName should 
return "a" and getColumnLabel should return "b".  Then getTableName could 
return "c" without inconsistency.  The problem is that a lot of code has 
been written assuming that getColumnName will return the aliased version, 
so we'd need a configuration option to determine which behavior to use.  
This makes it more work than just a straight switchover and is likely the 
reason this hasn't been done.

Kris Jurka




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: TableName
@ 2012-10-30 15:07  dmp <danap@ttc-cmc.net>
  parent: dmp <danap@ttc-cmc.net>
  0 siblings, 0 replies; 4+ messages in thread

From: dmp @ 2012-10-30 15:07 UTC (permalink / raw)
  To: goran.popov@prokomsoft.rs; pgsql-jdbc

 >> Goran Popov wrote:
 >>> AbstractJdbc2ResultSetMetaData.java
 >>>
 >>>
 >>> Whay this is default
 >>> public String getTableName(int column) throws SQLException
 >>> {
 >>> return "";
 >>> }
 >>>
 >>> and not this
 >>> public String getTableName(int column) throws SQLException
 >>> {
 >>> return getBaseTableName(column);
 >>> }
> On 10/29/2012 05:21 PM, dmp wrote:
>> Looks like perhasp because it is not applicable for a resultSet.
>> As per the the Java™ Platform, Standard Edition 6 API Specification.
>>
>> Interface ResultSetMetaData
>>
>> String getTableName(int column)
>> throws SQLException
>>
>> Gets the designated column's table name.
>>
>> Parameters:
>> column - the first column is 1, the second is 2, ...
>> Returns:
>> table name or "" if not applicable
>> Throws:
>> SQLException - if a database access error occurs
>>
>> Consider SELECT(1*2) resultSet.
>> Does that have a table name?
>>
>> danap.
>>
Goran Popov wrote:
>>
>>
> No and that shoud be empty "". But when there is table name than should
> be table name.

I agree and later upon reflection knew that the reason for not
returning the table name as such was more complicated as Kris
has provided hindsight to. When I first came to this forum I
read for insight and occasionally responded when I thought I
could contribute. Sometimes I also asked questions like yours
in order to point out perceived inconsistencies in the drivers
behavior. Later I found out that just as Rome was not build in
a day, but over years with many contributing no matter how modest.

danap.




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2012-10-30 15:07 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-10-29 15:30 TableName Goran Popov <goran.popov@prokomsoft.rs>
2012-10-29 16:21 ` dmp <danap@ttc-cmc.net>
2012-10-30 15:07   ` dmp <danap@ttc-cmc.net>
2012-10-30 01:49 ` Kris Jurka <books@ejurka.com>

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