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

sql: alter database set primary region does not work #59247

Closed
awoods187 opened this issue Jan 21, 2021 · 1 comment · Fixed by #60603
Closed

sql: alter database set primary region does not work #59247

awoods187 opened this issue Jan 21, 2021 · 1 comment · Fixed by #60603
Assignees
Labels
A-multiregion Related to multi-region C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)

Comments

@awoods187
Copy link
Contributor

SET PRIMARY REGION does not work while simply dropping SET works:

root@127.0.0.1:26257/movr> ALTER DATABASE movr SET PRIMARY REGION "us-east1";
invalid syntax: statement ignored: at or near "set": syntax error
SQLSTATE: 42601
DETAIL: source SQL:
ALTER DATABASE movr SET PRIMARY REGION "us-east1"
                    ^
HINT: try \h ALTER DATABASE
root@127.0.0.1:26257/movr> ALTER DATABASE movr PRIMARY REGION "us-east1";
ALTER DATABASE PRIMARY REGION

Time: 46ms total (execution 23ms / network 23ms)

This is despite hints telling you to use set:

ALTER DATABASE movr ADD REGION "us-east";
ERROR: cannot add region "us-east" to database movr
SQLSTATE: 42P12
HINT: you must add a PRIMARY REGION first using ALTER DATABASE movr SET PRIMARY REGION "us-east"

We should add support for SET PRIMARY REGION.

@awoods187 awoods187 added C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) A-multiregion Related to multi-region labels Jan 21, 2021
@awoods187
Copy link
Contributor Author

It doesn't work for alter either:

root@127.0.0.1:26257/movr> ALTER DATABASE movr SET PRIMARY REGION "us-west1";
invalid syntax: statement ignored: at or near "set": syntax error
SQLSTATE: 42601
DETAIL: source SQL:
ALTER DATABASE movr SET PRIMARY REGION "us-west1"
                    ^
HINT: try \h ALTER DATABASE
root@127.0.0.1:26257/movr> ALTER DATABASE movr PRIMARY REGION "us-west1";
ALTER DATABASE PRIMARY REGION

Time: 46ms total (execution 22ms / network 24ms)

@otan otan assigned otan and unassigned ajstorm Feb 16, 2021
craig bot pushed a commit that referenced this issue Feb 16, 2021
60603: parser: add alias for ALTER DATABASE ... SET PRIMARY REGION r=ajstorm a=otan

Resolves #59247

Release note: None

Co-authored-by: Oliver Tan <otan@cockroachlabs.com>
@craig craig bot closed this as completed in 587eac5 Feb 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-multiregion Related to multi-region C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants