SQL review doesn't execute all previous statements
artman opened this issue · comments
Provide the Bytebase version you are using
2.14.1
Describe the bug
Now that we can mix and match DML and DDL statements, we're running into issues where the SQL review fails for valid statements. Consider the following SQL migration:
ALTER TABLE "time_schedule" ADD "oauthClientName" character varying;
UPDATE "time_schedule" SET "oauthClientName" = 'incident.io' WHERE "oauthClientId" IS NOT NULL;
We do get an error for the second statement:
Validate the executability of DML statements #208
"UPDATE "time_schedule" SET "oauthClientName" = 'incident.io' WHERE "oauthClientId" IS NOT NULL;" dry runs failed: ERROR: column "oauthClientName" of relation "time_schedule" does not exist (SQLSTATE 42703)
The statement is run in isolation when in fact any preceding DDL statements should also be run first.
Steps to reproduce
Create an issue in Bytebase that modifies the database schema and then uses the modified schema to update data.
Expected behavior
No errors should be reported by the SQL check
Provide the database you are using
Postgres
Provide the version control system you are using
Github
Additional context
No response