Dropping and recreating a table with a SERIAL column while a server is running does not reset it.
- Dominant language
- Go
- Stars
- 2.1k
- Forks
- 73
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 129
Description
Steps to reproduce:
See the currently skipped asserts in the test `TestCreateFunctionLanguagePlpgsql/SELECT_INTO`
SERIAL tables are backed by sequences, and sequences are tracked across branches. This requires a global state that is separate from the state of a sequence on any given branch. However, we do not update that state when a sequence is dropped, the same way that we do for Dolt's AUTO INCREMENT columns. As a result, recreating the sequence will result in it continuing to produce values where it left off.
Contributor guide
Research direction
Start with the currently skipped asserts in TestCreateFunctionLanguagePlpgsql/SELECT_INTO and reproduce the drop-and-recreate case while the server is running. Trace how SERIAL-backed sequences are tracked and compare that behavior with Dolt AUTO INCREMENT columns. Done means recreating the sequence resets its generated values and the skipped asserts pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, postgresql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100