-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sql: support CREATE SEQUENCE #5811
Comments
Sort of related to the issue I filed on SERIAL: |
Update: nope, the following comment is wrong, kept for the archives. One reason to do this as not just a wrapper around |
|
|
We never made that change. |
I thought it was the opposite. Strike my comment then. |
@paperstreet Should we close this issue? |
I think leave it open and stick it in Later until someone needs it. SEQUENCE can be used for other things than implementing SERIAL |
A need for this was reported in #12481 |
A user also mentioned an issue with this when trying to load in pg dumped file. @nstewart |
@petermattis Why was |
No reason, just an oversight. |
Would it be possible to support the ALTER SEQUENCE support for changing the increment and the starting value? For example: ALTER SEQUENCE campaigns_id_seq INCREMENT BY 2 START WITH 31337 RESTART WITH 31337; INCREMENT BY 2 == increments sequence by 2 on every next value |
We shipped this in 2.0, minus a couple small PG compatibility issues, which have been filed with the label |
...and add support for the
nextval()
,currval()
andsetval()
functions. Note that these functions are atomic, but not transactional. We can implement them using the KV{Inc,Get,Set}
operations. We'll need to figure out where to store the sequence key. Postgres says that a sequence creates a special single-row table, which could work for us as well. Something like:Note that Postgres supports tying the lifetime of a sequence to the lifetime of a specific column in a table. That would require adding a field to
ColumnDescriptor
that would allowing cascading the deletion of a column (either by dropping the column or the entire table) to deletion of the associated sequences.The text was updated successfully, but these errors were encountered: