Well, the select itself returns the wrong name of the column. I am not using it in java function, just in SQL. For example, if you use a select with AS to create new table, e.g.:
CREATE TABLE SOMETHING AS SELECT foo as bar FROM HT_EXAMPLE ; The resulting table SOMETHING has one column called "foo" instead of "bar". Is this the correct behavior? On 1 dub, 16:43, Rami <[email protected]> wrote: > I am quessing you refer to getColumnName() method in ResultSetMetadata. > It is supposed to return the original column name. > Use getColumnLabel() if you want the name defined with AS. > > - rami > > On 04/01/2011 05:18 PM, David tefka wrote: > > > > > > > > > Hi, > > > if I select a column using "AS" operator, the resulting column name is > > sometimes taken from the original column name (and not from the "AS"). > > The following code explains the problem. > > > I am not sure if it is a bug or not, so I better report it :) > > > -- db version 1.3.153 (2011-03-14), same result in 1.2.145 > > > CREATE TABLE HT_EXAMPLE ( > > foo VARCHAR(8) > > ); > > > -- returns FOO > > SELECT > > foo > > FROM HT_EXAMPLE > > ; > > > -- returns FOO ??? > > SELECT > > foo as bar > > FROM HT_EXAMPLE > > ; > > > -- returns BAR - OK > > SELECT > > '' || foo as bar > > FROM HT_EXAMPLE > > ; -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
