Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 2.0.4
-
Fix Version/s: 2.1
-
Component/s: Schema Managers
-
Labels:None
-
Environment:Linux / Postgresql
Description
The Sequence class only has _initalValue which means that when a sequence is altered (by DROP and CREATE) the existing last_value, aka existing sequence ID is lost and the first attempt on flushing a new record results in a pkey exception.
This result in the sequence counter starting all over.
This can be handled by setting _initalValue to whatever is the last sequence value but since it is also used for setting MINVALUE this may not be a good idea. They should be split.
Not sure what name to use, last_value is from postgresql but I'm sure others use different names.
Not sure if this is entirely relevant to the question, but you can get the full details on a sequence by selecting * from it:
test=# select * from test_id_seq;
sequence_name | last_value | start_value | increment_by | max_value | min_value | cache_value | log_cnt | is_cycled | is_called
--------------
----------------------------------------------------------------------------------------+----------test_id_seq | 1 | 1 | 1 | 9223372036854775807 | 1 | 1 | 0 | f | t
(1 row)