Offset reserved word

339 views
Skip to first unread message

Paul Robinson

unread,
Sep 3, 2014, 8:33:17 AM9/3/14
to h2-da...@googlegroups.com
It looks like "offset" is a reserved word in version 1.4.181, where it wasn't in 1.3.176. In particular, you can't create a table with a column called offset unless you quote it.

Offset is not currently listed as a reserved word here:

To replicate this, start the console and run this:
CREATE TABLE THING (OFFSET DOUBLE);

and it gives a syntax error, while this does not:
CREATE TABLE THING (`OFFSET` DOUBLE);

Is this a bug in the code, the documentation, or am I doing something wrong?

Paul

Noel Grandin

unread,
Sep 3, 2014, 11:03:32 AM9/3/14
to h2-da...@googlegroups.com
We added support for the OFFSET keyword in the SELECT statement, see here:

http://h2database.com/html/grammar.html#select

You can work around this by quoting your column name.

Paul Robinson

unread,
Sep 3, 2014, 11:41:58 AM9/3/14
to h2-da...@googlegroups.com



--
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 h2-database...@googlegroups.com.
To post to this group, send email to h2-da...@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Noel Grandin

unread,
Sep 3, 2014, 11:49:04 AM9/3/14
to h2-da...@googlegroups.com
Oh yes, I see what you mean.

Thanks for reporting this, the website should update in a day or so.

Thomas Mueller

unread,
Sep 3, 2014, 1:05:13 PM9/3/14
to h2-da...@googlegroups.com
Hi,

You are right, this is not well documented yet, I will fix that. The reason for the change is added support for "select ... fetch first 1 row only" in the regular mode. In version 1.3.x, this was only supported in the DB2, Derby, and PostgreSQL mode. Actually this also applies to "fetch". At least in PostgreSQL, "fetch" and "offset" are also reserved keywords.

Regards,
Thomas

--

Thomas Mueller

unread,
Sep 3, 2014, 3:10:15 PM9/3/14
to h2-da...@googlegroups.com
Hi,

I see Noel already replied, sorry for sending (at least partially) the same info. The reason is that I sometimes prepare & send mails offline, which are then sent later on... so I didn't see Noels email.

Regards,
Thomas
Reply all
Reply to author
Forward
0 new messages