Skip to content
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

[YSQL] Add support for ALTER SEQUENCE #1002

Closed
hectorgcr opened this issue Mar 14, 2019 · 2 comments
Closed

[YSQL] Add support for ALTER SEQUENCE #1002

hectorgcr opened this issue Mar 14, 2019 · 2 comments
Assignees
Labels
kind/enhancement This is an enhancement of an existing feature

Comments

@hectorgcr
Copy link
Contributor

hectorgcr commented Mar 14, 2019

Currently we can create and delete a sequence but we cannot alter it.

This is especially important for our sequences implementation because we want users to not use SERIAL types but instead its equivalent using a large value for CACHE:

CREATE SEQUENCE tablename_colname_seq CACHE 100000;
CREATE TABLE tablename (
    colname integer NOT NULL DEFAULT nextval('tablename_colname_seq')
);
ALTER SEQUENCE tablename_colname_seq OWNED BY tablename.colname;
@hectorgcr hectorgcr self-assigned this Mar 14, 2019
@hectorgcr hectorgcr added the kind/enhancement This is an enhancement of an existing feature label Mar 14, 2019
yugabyte-ci pushed a commit that referenced this issue May 22, 2019
Summary: This diff enables support for ALTER SEQUENCE

Test Plan: New unit tests

Reviewers: mihnea, robert

Reviewed By: robert

Subscribers: yql

Differential Revision: https://phabricator.dev.yugabyte.com/D6337
@lukaseder
Copy link

The requested syntax should be possible by now, see: https://docs.yugabyte.com/latest/api/ysql/the-sql-language/statements/ddl_alter_sequence/

But this issue is still being referenced when attempting to rename a sequence using:

ALTER SEQUENCE s1 RENAME TO s2;

@OlegLoginov
Copy link
Contributor

OlegLoginov commented Oct 15, 2024

As I see the feature implements the following sub-set of ALTER SEQUENCE s SeqOptElem commands:

SeqOptElem:		  AS SimpleTypename
			| CACHE NumericOnly
			| CYCLE
			| NO CYCLE
			| INCREMENT opt_by NumericOnly
			| MAXVALUE NumericOnly
			| MINVALUE NumericOnly
			| NO MAXVALUE
			| NO MINVALUE
			| OWNED BY any_name
			| SEQUENCE NAME_P any_name
			| START opt_with NumericOnly
			| RESTART
			| RESTART opt_with NumericOnly

Other ALTER SEQUENCE sub-commands are not supported yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement This is an enhancement of an existing feature
Projects
None yet
Development

No branches or pull requests

3 participants