Bugs item #2846238, was opened at 2009-08-28 13:38
Message generated for change (Settings changed) made by nielsnes
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=2846238&group_id=56967

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: SQL/Core
Group: None
>Status: Closed
Resolution: Fixed
Priority: 5
Private: No
Submitted By: Matthew W. Jones (matburt)
Assigned to: Niels Nes (nielsnes)
Summary: alter sequence restart on large integer

Initial Comment:
I believe I may have found a bug in the sequence though... I want to make sure 
that this value will not have problems when working with large integers:

sql> CREATE SEQUENCE "test_seq" as bigint;
sql> select next value for test_seq;
+------------------------------+
| next_value_for_testdb |
+==============================+
|                            1 |
+------------------------------+

sql> alter sequence test_seq restart with 3000000000;
sql> select next value for test_seq;
+------------------------------+
| next_value_for_testdb |
+==============================+
|                   2147483647 |
+------------------------------+

I can always increment the sequence higher, but if I try to alter it to 
anything past the maximum value for a 32-bit integer then it will reset to it.

sql>select next value for test_seq;
+------------------------------+
| next_value_for_testdb |
+==============================+
|                   2147483648 |
+------------------------------+
1 tuple
sql>select next value for test_seq;
+------------------------------+
| next_value_for_testdb |
+==============================+
|                   2147483649 |
+------------------------------+


----------------------------------------------------------------------

Comment By: Niels Nes (nielsnes)
Date: 2009-09-03 20:38

Message:
added test restart_with_large_int.SF-2846238.sql 


----------------------------------------------------------------------

Comment By: Niels Nes (nielsnes)
Date: 2009-09-03 20:38

Message:
Fixed by properly handling long integers in the parsers 'restart with'
code.

----------------------------------------------------------------------

Comment By: Matthew W. Jones (matburt)
Date: 2009-08-28 17:06

Message:
It's also interesting that selecting next value uses the name of the schema
instead of the name of the sequence when selecting the next value.

----------------------------------------------------------------------

Comment By: Matthew W. Jones (matburt)
Date: 2009-08-28 17:04

Message:
Selecting the next value seems to do the right thing:


sql>select next value for my_other_test_seq ;
+------------------------------+
| next_value_for_datawarehouse |
+==============================+
|                   2147483649 |
+------------------------------+
1 tuple
sql>explain select next value for my_other_test_seq;
+-------------------------------------------------------------------------------------------------------+
| function user.s5_1{autoCommit=true}():void;                             
                             |
|     _4 := sql.next_value("datawarehouse","my_other_test_seq");          
                             |
|    
sql.exportValue(1,".","next_value_for_datawarehouse","bigint",64,0,6,_4,"");
                     |
| end s5_1;                                                               
                             |
+-------------------------------------------------------------------------------------------------------+
sql>


----------------------------------------------------------------------

Comment By: Matthew W. Jones (matburt)
Date: 2009-08-28 16:26

Message:
Here's some more interesting information:

sql>explain alter sequence my_other_test_seq restart with 3000000000 ;
+-------------------------------------------------------------------------------------------------------+
| function user.s0_1{autoCommit=true}():void;                             
                             |
|     sql.restart("sys","my_other_test_seq",2147483647:lng);              
                             |
|     sql.exportOperation("");                                            
                             |
| end s0_1;                                                               
                             |
+-------------------------------------------------------------------------------------------------------+
sql>


----------------------------------------------------------------------

Comment By: Matthew W. Jones (matburt)
Date: 2009-08-28 15:29

Message:
I'm actually doing this outside of an auto increment or serial field in a
table.... I'm just strictly creating, querying, and altering the sequence. 
 Looking in the 'sequences' table shows that all of its integer fields are
bigints.... it also seems to increment past a 32-bit integer.... the error
must be in the code that takes the new value during the sql query for
'alter sequence restart ...'

----------------------------------------------------------------------

Comment By: Fabian (mr-meltdown)
Date: 2009-08-28 14:03

Message:
This might actually be a bug related to serial being a INT, not a BIGINT. 
We should probably implement bigserial, and fix the sequence code here not
to accept the too large value.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=2846238&group_id=56967

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Monetdb-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-bugs

Reply via email to