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 review doesn't execute all previous statements #11374

Open
artman opened this issue Mar 27, 2024 · 0 comments
Open

SQL review doesn't execute all previous statements #11374

artman opened this issue Mar 27, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@artman
Copy link

artman commented Mar 27, 2024

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

@artman artman added the bug Something isn't working label Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants