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

Escape schema/tablenames in metadata.getTables() #2398

Merged
merged 4 commits into from Feb 14, 2022

Conversation

nvoxland
Copy link
Contributor

@nvoxland nvoxland commented Jan 24, 2022

Description

Escape _'s and %s in schema/table names used in getTables() because so that searches for a table with an _ in them won't also match tables without them, since the jdbc method uses those in LIKE operations

Fixes #1604


Dev Handoff Notes (Internal Use)

Links

Testing

Dev Verification

Replicated issue by running changelog:

    <changeSet id="1" author="example">
        <createTable tableName="testTable">
            <column name="id" type="int"/>
        </createTable>
    </changeSet>

with defaultSchemaName=test_schema and then with defaultSchemaName="test-schema" on postgresql. After those two successful updates, any future runs against defaultSchemaName=test_schema failed. NOTE: the reproduction does depend a bit on how the database returns rows back internally. I initially tried testrschema as an alternative to test_schema but it worked because test_schema came back before testrschema in the problem query.

┆Issue is synchronized with this Jira Bug by Unito

@nvoxland nvoxland added this to To Do in Conditioning++ via automation Jan 24, 2022
@nvoxland nvoxland moved this from To Do to Code Review in Conditioning++ Jan 24, 2022
@suryaaki2 suryaaki2 moved this from Code Review to Ready for Handoff (In JIRA) in Conditioning++ Jan 25, 2022
def db = DatabaseFactory.instance.findCorrectDatabaseImplementation(new JdbcConnection(connection))
db.execute([
new RawSqlStatement("create schema if not exists \"TEST_SCHEMA\""),
new RawSqlStatement("create schema if not exists \"TEST-SCHEMA\""),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The setup of the schemas and objects makes for a really nice, readable test validation. I wish I'd thought of this when I was doing the manual tests! :) Thanks for the test, @nvoxland.

@nvoxland nvoxland merged commit 9333465 into master Feb 14, 2022
Conditioning++ automation moved this from Ready for Handoff (In JIRA) to Done Feb 14, 2022
@nvoxland nvoxland deleted the escape-names-in-getTables branch February 14, 2022 14:49
@nvoxland nvoxland added this to the v4.8.0 milestone Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Underscore in schemaName causes error relation "databasechangelog" already exists
3 participants