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
Fixes issue with incorrect schema in column exists precondition when checking using a snapshot #5795
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @mpvvliet,
Thank you for another PR. Your code changes look good I would only do again a little suggestion asking you to do the same little refactor (extracting this piece of code in a getSchema method). Other than that, it looks ok to me.
Thanks,
Daniel.
@@ -90,7 +90,11 @@ | |||
private void checkUsingSnapshot(Database database, DatabaseChangeLog changeLog) throws PreconditionFailedException, PreconditionErrorException { | |||
Column example = new Column(); | |||
if (StringUtil.trimToNull(getTableName()) != null) { | |||
example.setRelation(new Table().setName(database.correctObjectName(getTableName(), Table.class)).setSchema(new Schema(getCatalogName(), getSchemaName()))); | |||
String schemaName = getSchemaName(); |
Check notice
Code scanning / CodeQL
Possible confusion of local and field Note
checkUsingSnapshot
schemaName
…checking using a snapshot
Fixes #5666
Impact
Description
When checking for existence of a column using a snapshot, the schema is incorrectly included, leading to an SQL query with a
null
schema. Included code to explicitly use the database default schema if none is set in the precondition.Tested this on MySQL.
Things to be aware of
Things to worry about
Additional Context