-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: renamed or dropped column remains visible to introspection commands in the same transaction #58067
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.
Description
Describe the problem
It is possible to drop/rename a column in a transaction and have it remain visible.
To Reproduce
root@localhost:26257/defaultdb> begin;
root@localhost:26257/defaultdb OPEN> create index idx on t (i asc);
root@localhost:26257/defaultdb OPEN> alter table t rename column i to j;
root@localhost:26257/defaultdb OPEN> show columns from t;
column_name | data_type | is_nullable | column_default | generation_expression | indices | is_hidden
--------------+-----------+-------------+----------------+-----------------------+-----------+------------
j | INT8 | true | NULL | | {} | false
rowid | INT8 | false | unique_rowid() | | {primary} | true
root@localhost:26257/defaultdb OPEN> alter table t rename column j to i;
root@localhost:26257/defaultdb OPEN> show columns from t;
column_name | data_type | is_nullable | column_default | generation_expression | indices | is_hidden
--------------+-----------+-------------+----------------+-----------------------+-----------+------------
j | INT8 | true | NULL | | {} | false
rowid | INT8 | false | unique_rowid() | | {primary} | true
root@localhost:26257/defaultdb OPEN> commit;
Expected behavior
Upon renaming the column from j back to i, the column j should not be visible.
Additional Info
This problem showed up in this schemachange roachtest failure.
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.