Thanks for the reply Thomas, but now I'm more confused.

First, thanks for catching my mistake with the double =.

Second, the error implied an understanding that limit was a keyword.
I clearly stated that I could not use another word, and asked for a
work around.  On top of that it seems like I found the work around
that I was asking for by using quotes.  Yet you still suggest that I
find a different word.  That's still not an option.  But now my
question is, is there something wrong with using quotes as
illustrated?  Is there a performance impact, compatibility issues, is
it deprecated?  Why wasn't using quotes your suggestion?  I'm tempted
to put quotes around all column names unless there is a problem with
it.
Thanks,
Clay



On Feb 17, 1:30 pm, Thomas Mueller <[email protected]>
wrote:
> Hi,
>
> LIMIT is a keyword and can't be used as an object name, sorry.
> PostgreSQL doesn't support LIMIT as well. The list of keywords for H2
> is:
>
> CROSS, CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP, DISTINCT,
> EXCEPT, EXISTS, FALSE,
> FOR, FROM, FULL, GROUP, HAVING, INNER, INTERSECT, IS, JOIN, LIKE,
> LIMIT, MINUS, NATURAL, NOT, NULL,
> ON, ORDER, PRIMARY, ROWNUM, SELECT, SYSDATE, SYSTIME, SYSTIMESTAMP,
> TODAY, TRUE, UNION, WHERE
>
> The list of keywords for other databases may be a bit different (most
> other database have more keywords). This is 
> documentedhttp://www.h2database.com/html/advanced.html#compatibility,
> unfortuantely the LIMIT is missing (I will add it in the next
> release).
>
> I suggest to use another word. The second problem is that == is not a
> SQL comparator. Use = as in:
>
> CREATE TABLE Limited ("Limit" INTEGER);
> select * from Limited where "Limit" = 1
>
> Regards,
> Thomas
>
> On Tue, Feb 17, 2009 at 8:03 PM, Clay <[email protected]> wrote:
>
> > It looks like I can add quotes like this:
> > CREATE TABLE Limited ("Limit" INTEGER);
>
> > But I can't make selects work with or without quotes:
> > select * from Limited where Limit == 1
> > select * from Limited where "Limit" == 1
>
> > org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement SELECT *
> > FROM LIMITED WHERE LIMIT[*] == 1 ; expected NOT, EXISTS, SELECT, FROM;
> > SQL statement:
>
> > On Feb 17, 12:27 pm, Clay <[email protected]> wrote:
> >> CREATE TABLE Limited (Limit INTEGER);
>
> >> When I try to create a table like this I get the following exception.
> >> Naming the column "Limit" is not something that can be changed.  This
> >> seems like a silly reason to not be able to use H2, can someone
> >> explain how to get around this problem.  Thanks.
>
> >> org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement
> >>     CREATE TABLE LIMITED (LIMIT[*] INTEGER);
> >>      ; expected identifier; SQL statement:
>
> >>     CREATE TABLE Limited (Limit INTEGER);
> >>      [42001-79]
> >>         at org.h2.message.Message.getSQLException(Message.java:103)
> >>         at org.h2.message.Message.getSQLException(Message.java:114)
> >>         at org.h2.message.Message.getSyntaxError(Message.java:139)
> >>         at org.h2.command.Parser.readColumnIdentifier(Parser.java:2480)
> >>         at org.h2.command.Parser.parseCreateTable(Parser.java:4567)
> >>         at org.h2.command.Parser.parseCreate(Parser.java:3410)
> >>         at org.h2.command.Parser.parsePrepared(Parser.java:321)
> >>         at org.h2.command.Parser.parse(Parser.java:288)
> >>         at org.h2.command.Parser.parse(Parser.java:260)
> >>         at org.h2.command.Parser.prepareCommand(Parser.java:232)
> >>         at org.h2.engine.Session.prepareLocal(Session.java:285)
> >>         at org.h2.engine.Session.prepareCommand(Session.java:246)
> >>         at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:
> >> 1063)
> >>         at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:151)
> >>         at groovy.sql.Sql.execute(Sql.java:804)
> >>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >>         at sun.reflect.NativeMethodAccessorImpl.invoke
> >> (NativeMethodAccessorImpl.java:39)
> >>         at sun.reflect.DelegatingMethodAccessorImpl.invoke
> >> (DelegatingMethodAccessorImpl.java:25)
> >>         at org.codehaus.groovy.reflection.CachedMethod.invoke
> >> (CachedMethod.java:86)
> >>         at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
> >>         at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:912)
> >>         at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:756)
> >>         at org.codehaus.groovy.runtime.InvokerHelper.invokePojoMethod
> >> (InvokerHelper.java:766)
> >>         at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod
> >> (InvokerHelper.java:754)
> >>         at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN
> >> (ScriptBytecodeAdapter.java:170)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to