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 TABLE commands can incorrectly become no-ops #52816

Closed
solongordon opened this issue Aug 14, 2020 · 1 comment · Fixed by #52819
Closed

sql: ALTER TABLE commands can incorrectly become no-ops #52816

solongordon opened this issue Aug 14, 2020 · 1 comment · Fixed by #52819
Assignees
Labels
A-schema-changes C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.

Comments

@solongordon
Copy link
Contributor

Due to some bad accounting of whether the table descriptor has changed, ALTER TABLE sometimes does not perform the requested changes.

[email protected]:61248/movr> create table t (x int, y int);
CREATE TABLE

[email protected]:61248/movr> alter table t rename column x to x2, rename column y to y;
ALTER TABLE

[email protected]:61248/movr> show create table t;
  table_name |          create_statement
-------------+-------------------------------------
  t          | CREATE TABLE public.t (
             |     x INT8 NULL,
             |     y INT8 NULL,
             |     FAMILY "primary" (x, y, rowid)
             | )
@solongordon solongordon added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. A-schema-changes labels Aug 14, 2020
@solongordon solongordon self-assigned this Aug 14, 2020
@solongordon
Copy link
Contributor Author

Note this only affects ALTER TABLE commands with multiple operations where the last operation has no effect. (And only certain operations at that.)

craig bot pushed a commit that referenced this issue Aug 14, 2020
52819: sql: fix ALTER TABLE descriptorChanged bug r=solongordon a=solongordon

There was some bad accounting in the ALTER TABLE command for whether the
table descriptor had changed or not. This meant that for ALTER TABLE
statements with multiple actions, we might incorrectly treat the whole
statement as a no-op if the last action had no effect.

Fixes #52816

Release note (bug fix): Fixed a bug for ALTER TABLE statements with
multiple actions. In certain cases if the last action had no effect, the
entire statement would be treated as a no-op.

Co-authored-by: Solon Gordon <[email protected]>
@craig craig bot closed this as completed in 6d065ef Aug 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-schema-changes C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant