8000 sql/schema: ALTER TABLE RENAME with multiple table names · Issue #148336 · cockroachdb/cockroach · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
sql/schema: ALTER TABLE RENAME with multiple table names #148336
Open
@dikshant

Description

@dikshant

Under the legacy schema changer the following is possible

CREATE TABLE old_table1 (
    id INT PRIMARY KEY,
    name STRING
);

CREATE TABLE old_table2 (
    id INT PRIMARY KEY,
    description STRING
);

CREATE TABLE old_table3 (
    id INT PRIMARY KEY,
    created_at TIMESTAMPTZ
);

SET autocommit_before_ddl=off; -- 25.1

BEGIN;
ALTER TABLE old_table1 RENAME TO new_table1;
ALTER TABLE old_table2 RENAME TO new_table2;
ALTER TABLE old_table3 RENAME TO new_table3;
COMMIT;

It would be nice if we could provide a single line equivalent in declarative schema changer similar to how we can chain other ALTER:

ALTER TABLE old_table1 RENAME TO new_table1,
             old_table2 RENAME TO new_table2,
             old_table3 RENAME TO new_table3;

Jira issue: CRDB-51549

Epic CRDB-31465

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-schema-changesC-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)T-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0