DBAL-113: The Sequence class lacks last value / start value #1071

Closed
doctrinebot opened this Issue Apr 26, 2011 · 3 comments

2 participants

@doctrinebot

Jira issue originally created by user thomasez:

The Sequence class only has initalValue which means that when a sequence is altered (by DROP and CREATE) the existing lastvalue, 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.

@doctrinebot

Comment created by ddebernardy:

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 testidseq;
sequencename | last_value | start_value | increment_by | max_value | min_value | cache_value | log_cnt | is_cycled | iscalled
-----------------------------------------------------------------------------------------------------------------------+-----------
testidseq | 1 | 1 | 1 | 9223372036854775807 | 1 | 1 | 0 | f | t
(1 row)

@doctrinebot

Comment created by @beberlei:

Fixed by using ALTER SEQUENCE which only changes the increment.

@doctrinebot

Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added the Bug label Dec 6, 2015
@beberlei beberlei was assigned by doctrinebot Dec 6, 2015
@doctrinebot doctrinebot added this to the 2.1 milestone Dec 6, 2015
@doctrinebot doctrinebot closed this Dec 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment