-
Notifications
You must be signed in to change notification settings - Fork 545
Description
SQLDelight Version
2.0.0-alpha05 (and master)
SQLDelight Dialect
Postgres
Describe the Bug
Using ALTER TABLE ... RENAME COLUMN
to rename a column twice doesn't work. The result of the first name is not "seen" by the second ALTER
statement. In the snippet below, the error shouldn't exist.
CREATE TABLE test (
value TEXT NOT NULL
);
ALTER TABLE test
RENAME COLUMN value TO value2;
-- error[col 16]: No column found to modify with name value2
ALTER TABLE test
RENAME COLUMN value2 TO value3;
This happens within a single migration file, but also across migrations. The issue can be reproduced by adding the last ALTER
statement from above to dialects/postgresql/src/test/fixtures_postgresql/alter-table-rename-column/1.s
Investigation shows that the LazyQuery
returned by dialects/postgresql/src/main/kotlin/app/cash/sqldelight/dialects/postgresql/grammar/mixins/AlterTableRenameColumnMixin.kt
doesn't get evaluated for the second ALTER
statement. I suspect it should, but I don't know the changes needed to make that happen.
Stacktrace
No response