SELECT * returns 1

41 views
Skip to first unread message

Sergi Vladykin

unread,
Aug 15, 2012, 8:19:27 AM8/15/12
to h2-da...@googlegroups.com
Hi,

Running query "SELECT *" returns one row with column named X and value 1. Query "SELECT X" works as well. Is it intended behavior? I expected such a query to fail with error.

Sergi

Thomas Mueller

unread,
Aug 15, 2012, 4:34:49 PM8/15/12
to h2-da...@googlegroups.com
Hi,

SELECT 1 and SELECT "Hello" also works, and is required to work for compatibility with other databases. Internally, this is converted to SELECT .. FROM DUAL. And DUAL is a table with one column (X) and one row (1).

Regards,
Thomas



Sergi

--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To view this discussion on the web visit https://groups.google.com/d/msg/h2-database/-/ANbUZYPTvNQJ.
To post to this group, send email to h2-da...@googlegroups.com.
To unsubscribe from this group, send email to h2-database...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.

Sergi Vladykin

unread,
Aug 15, 2012, 4:53:52 PM8/15/12
to h2-da...@googlegroups.com
I completely understand technical reasons but I don't believe that in any database engine query like SELECT * or SELECT X will work. Don't you think its a bug?

Sergi

Thomas Mueller

unread,
Aug 15, 2012, 5:12:38 PM8/15/12
to h2-da...@googlegroups.com
Hi,

No, I don't think it's a bug. My boss once said the definition of a bug is a difference between implementation and documentation / specification. In this case it's more like unexpected or strange behavior. But I don't think it is documented or specified anywhere that "SELECT *" or "SELECT X" is supposed to fail.

Regards,
Thomas



To view this discussion on the web visit https://groups.google.com/d/msg/h2-database/-/fFApFcWsbS0J.
Reply all
Reply to author
Forward
0 new messages