Version: 1.3.171

select ID as ITEM_ID from ITEM

ResultSetMetaData#getColumnName(1) returns "ID"
ResultSetMetaData#getColumnLabel(1) returns "ITEM_ID"

This is correct. However, I should not be able to use the name for lookup 
on the ResultSet, only the label:

ResultSet#findColumn("ID") returns 1
ResultSet#findColumn("ITEM_ID") returns 1

The first findColumn() should fail with an SQLException, the Javadoc for 
the method is: "Maps the given ResultSet column label to its ResultSet 
column index."

The argument of the method is "the label for the column specified with the 
SQL AS clause. If the SQL AS clause was not specified, then the label is 
the name of the column".

This also affects all get*() operations on the ResultSet. 

It looks like H2 falls back and searches for the column name when the label 
can't be found. I think it should throw an exception, as per Javadoc "if 
the ResultSet object does not contain a column labeled columnLabel".

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to