-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: ALTER TABLE ... ADD COLUMN ... PRIMARY KEY doesn't work correctly #81449
Copy link
Copy link
Closed
Labels
A-schema-changesC-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.T-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Description
To repro:
CREATE TABLE t (a INT PRIMARY KEY);
ALTER TABLE t ADD COLUMN b INT PRIMARY KEY;
Expected: the primary key is an error is returned (in pg: bmultiple primary keys for table "t" are not allowed)
Actual: success, and a subsequent SHOW CREATE TABLE t yields
table_name | create_statement
-------------+---------------------------------------------
t | CREATE TABLE public.t (
| a INT8 NOT NULL,
| b INT8 NOT NULL,
| CONSTRAINT t_pkey PRIMARY KEY (a ASC),
| UNIQUE INDEX t_b_key (b ASC)
| )
(1 row)
Jira issue: CRDB-15178
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-schema-changesC-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.T-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)SQL Foundations Team (formerly SQL Schema + SQL Sessions)