Skip to content

sql: renamed or dropped column remains visible to introspection commands in the same transaction #58067

@jayshrivastava

Description

@jayshrivastava

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-schema-changesC-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions