SELECT command that returns a strange RESULSET

39 views
Skip to first unread message

prrvchr

unread,
Sep 5, 2022, 10:25:45 AM9/5/22
to H2 Database
Hi all,

During my tests for the integration of H2 in Base, I unwittingly discovered a strange behavior of a SELECT command with an error on the column name.

SELECT USER FROM INFORMATION_SCHEMA.USERS

The correct column name is USER_NAME but this SELECT does not throw an SQLException and return a strange ResultSet...


Evgenij Ryazanov

unread,
Sep 5, 2022, 11:44:48 AM9/5/22
to H2 Database
Hi!

USER is not an identifier. It is a reserved word in the SQL Standard. It has exactly the same meaning as CURRENT_USER in the SQL Standard and in H2.

prrvchr

unread,
Sep 5, 2022, 12:00:45 PM9/5/22
to H2 Database
Newbie mistake, thank you Evgenij Ryazanov,, it took me a while to find the malfunction now I understand it.
Reply all
Reply to author
Forward
0 new messages