yarmol / h2database

Automatically exported from code.google.com/p/h2database
0 stars 0 forks source link

Add support for sequence max value, min value and cycle #520

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The attached patch adds the following features, lack of which was keeping us 
from using H2:

CREATE SEQUENCE: support for MINVALUE, NOMINVALUE, NO MINVALUE, MAXVALUE, 
NOMAXVALUE, NO MAXVALUE, CYCLE, NOCYCLE, NO CYCLE, NOCACHE and NO CACHE clauses.

ALTER SEQUENCE: add support for MINVALUE, NOMINVALUE, NO MINVALUE, MAXVALUE, 
NOMAXVALUE, NO MAXVALUE, CYCLE, NOCYCLE, NO CYCLE, CACHE, NOCACHE and NO CACHE 
clauses.

This should round out the sequence support and bring H2 close to parity with a 
number of RDBMS:

CREATE SEQUENCE:
Oracle: 
http://docs.oracle.com/cd/B12037_01/server.101/b10759/statements_6014.htm
MS SQL Server: http://technet.microsoft.com/en-us/library/ff878091.aspx
PostgreSQL: http://www.postgresql.org/docs/8.1/static/sql-createsequence.html

ALTER SEQUENCE:
Oracle: 
http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_2012.htm#SQLRF0
0817
MS SQL Server: http://technet.microsoft.com/en-us/library/ff878572.aspx
PostgreSQL: http://www.postgresql.org/docs/8.1/static/sql-altersequence.html

Original issue reported on code.google.com by djgred...@gmail.com on 30 Oct 2013 at 3:20

Attachments:

GoogleCodeExporter commented 9 years ago
Very nice, thank you.

Please can we get a license statement: see 
    http://h2database.com/html/build.html#providing_patches
for details.

Original comment by noelgrandin on 31 Oct 2013 at 11:46

GoogleCodeExporter commented 9 years ago
I wrote the code, it's mine, and I'm contributing it to H2 for distribution 
multiple-licensed under the H2 License, version 1.0, and under the Eclipse 
Public License, version 1.0 (http://h2database.com/html/license.html).

Let me know if you need anything else!

Original comment by djgred...@gmail.com on 31 Oct 2013 at 2:23

GoogleCodeExporter commented 9 years ago
Thank you very much, patch committed with minor changes in revision 5278

Original comment by noelgrandin on 4 Nov 2013 at 7:29

GoogleCodeExporter commented 9 years ago

Original comment by noelgrandin on 4 Nov 2013 at 7:29

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Can anyone help with applying these patches to h2 database? 

Original comment by ponni86....@gmail.com on 27 Dec 2013 at 7:29

GoogleCodeExporter commented 9 years ago
Pinning, this patch has already been committed. 

Original comment by noelgrandin on 27 Dec 2013 at 9:54

GoogleCodeExporter commented 9 years ago
So do I need to upgrade my existing  H2 1.3.173 (2013-07-28) to higher version 
for "Create Sequence SEq_Name 
start with
MAXVALUE...:"

to work?? If yes, which version do i updgrade to?

Original comment by ponni86....@gmail.com on 27 Dec 2013 at 10:03

GoogleCodeExporter commented 9 years ago
Upgraded to latest version, but the following doesn't support

"CREATE SEQUENCE ORDER_SEQ
START WITH 500
INCREMENT BY 1
MAXVALUE 1000
CYCLE
CACHE 32"

Original comment by ponni86....@gmail.com on 27 Dec 2013 at 10:50

GoogleCodeExporter commented 9 years ago
Ponni, this change has not been released in an official build yet. 
If you want to test it, use the nightly build at 
http://h2database.com/html/build.html#automated

Original comment by noelgrandin on 27 Dec 2013 at 6:54

GoogleCodeExporter commented 9 years ago
Has this fix been pushed out yet?

I'm getting the following error:
org.h2.jdbc.JdbcSQLException: Numeric value out of range: 
"999999999999999999999999"

I'm trying to apply my existing oracle schema.

Original comment by katel...@gmail.com on 2 Jul 2014 at 5:56

GoogleCodeExporter commented 9 years ago
@katelfox, this fix has been pushed already.

Your existing oracle schema will not work because we do not support values 
beyond Long.MAX_VALUE

Original comment by noelgrandin on 3 Jul 2014 at 2:37

GoogleCodeExporter commented 9 years ago
@noelgrandin thank you for the quick response.

Original comment by katel...@gmail.com on 6 Jul 2014 at 3:39