Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

Re: ResultSetMetaData enhancements




On Mon, 12 Jul 2004, ow wrote:

> Yes, rsmd.getTableName() appears to work. However, I was under
> impression that the folowing should also work (but it does not):
> 
> someValue = rs.getXXX("table.column"); // instead of just rs.getXXX("column")
> 
> This would be usefull if result set contained two columns from different
> tables with the same name.
> 

It actually isn't rs.getXXX("column"), it's the alias given to a select 
output.  Note that "SELECT a AS b FROM tab" will need to use 
rs.getXXX("b"), not "a".  There are some rules for coming up with a 
default alias which make the column name the alias for plain 
columns without aliases.

Adding the tablename to the getXXX method doesn't seem any cleaner to me 
than providing a select alias for the column and actually would have some 
implementation issues.  Notably column names are allowed to have a . in 
them, so how would you know when someone was providing a table name.

Kris Jurka



Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group