| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
convertAlterTableStmt returned on the first RENAME COLUMN spec, so any further renames in the same ALTER TABLE were dropped and queries using the later columns failed to compile. Emit an AT_RenameColumn command per spec, like the other multi-spec actions, and apply it in the catalog. Fixes sqlc-dev#4493
| Back | FazBrowse Home | New Git URL |
Multi-column MySQL ALTER TABLE statements that use more than one RENAME COLUMN only had the first rename applied. Queries referencing the later renamed columns then failed code generation with column "..." does not exist.
The MySQL converter (convertAlterTableStmt) returned a RenameColumnStmt as soon as it hit the first RENAME COLUMN spec, so the remaining specs in the same statement were never processed. There was already a // TODO: Returning here may be incorrect if there are multiple specs note on that branch.
This emits an AT_RenameColumn command for each rename spec, the same way ADD / DROP / MODIFY COLUMN already accumulate into the command list, and applies it in the catalog (reusing the existing rename logic). Single renames keep working as before.
Added an end-to-end test (ddl_alter_table_rename_column_multiple/mysql) that renames two columns in one statement and selects both.
Fixes #4493