That new syntax does the trick, thanks. I notice that the case seems
to matter. If I use lowercase for either the schema name or the table
name in the call to 'nextval' it fails to locate the object. The case
does not seem to matter in "create sequence" or "create schema". I
confess ignorance as to how this should actually work in standard SQL,
but it is a surprise.
I work out of svn, so I'll keep an eye out for that fix.
Thanks!
On Sun, Oct 26, 2008 at 1:41 PM, Thomas Mueller
<[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> This is an incompatibility with PostgreSQL. I will fix that in the
> next release. A workaround is to use:
>
> select nextval('CONF', 'REPORT_ID_SEQ');
>
> Unfortunately this is not supported by PostgreSQL.
>
> Regards,
> Thomas
>
> On Sat, Oct 25, 2008 at 4:24 AM, Limbic System <[EMAIL PROTECTED]> wrote:
>>
>> If I create a sequence inside a schema I can't seem to "find" it:
>>
>>
>> public static void main(String[] args) throws Exception {
>> String jdbcUrl =
>> "jdbc:h2:mem:;MODE=PostgreSQL;DB_CLOSE_DELAY=-1;TRACE_LEVEL_SYSTEM_OUT=4";
>> String driver = "org.h2.Driver";
>>
>> Class.forName(driver);
>> Connection conn = DriverManager.getConnection(jdbcUrl, "DBA", "");
>> Statement st = conn.createStatement();
>> st.executeUpdate("drop schema conf if exists; create schema conf;");
>> st.executeUpdate("create sequence conf.report_id_seq;");
>> st.executeQuery("select nextval('conf.report_id_seq');");
>> }
>>
>>
>> Exception in thread "main" org.h2.jdbc.JdbcSQLException: Sequence
>> CONF.REPORT_ID_SEQ not found; SQL statement:
>> select nextval('conf.report_id_seq'); [90036-101]
>> at org.h2.message.Message.getSQLException(Message.java:103)
>> at org.h2.message.Message.getSQLException(Message.java:114)
>> at org.h2.message.Message.getSQLException(Message.java:77)
>> at org.h2.schema.Schema.getSequence(Schema.java:423)
>> at org.h2.expression.Function.getSequence(Function.java:1125)
>> at org.h2.expression.Function.getValueWithArgs(Function.java:1025)
>> at org.h2.expression.Function.getValue(Function.java:406)
>> at org.h2.command.dml.Select.queryFlat(Select.java:499)
>> at org.h2.command.dml.Select.queryWithoutCache(Select.java:560)
>> at org.h2.command.dml.Query.query(Query.java:233)
>> at org.h2.command.CommandContainer.query(CommandContainer.java:81)
>> at org.h2.command.Command.executeQueryLocal(Command.java:140)
>> at org.h2.command.Command.executeQuery(Command.java:121)
>> at org.h2.jdbc.JdbcStatement.executeQuery(JdbcStatement.java:75)
>>
>>
>> If I simply remove the ".conf" from the create/select, it works fine.
>>
>> Thanks.
>>
>> >
>>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---