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

loadData not escaping single quotes correctly #94

Closed
evtilley opened this issue Jun 9, 2021 · 0 comments · Fixed by #95
Closed

loadData not escaping single quotes correctly #94

evtilley opened this issue Jun 9, 2021 · 0 comments · Fixed by #95

Comments

@evtilley
Copy link

evtilley commented Jun 9, 2021

When using loadData to import a CSV, the changeset fails if there is a string in the CSV that contains a single quote. This is happening because Liquibase attempts to escape the single quote as '' rather than as \'. For example,

IntVal,StrVal
1,"This won't work"
Unexpected error running Liquibase: Migration failed for change set changelog.yaml::load-data-Test::evtilley:
     Reason: liquibase.exception.DatabaseException: INVALID_ARGUMENT: com.google.api.gax.rpc.InvalidArgumentException: io.grpc.StatusRuntimeException: INVALID_ARGUMENT: Syntax error: Expected ")" or "," but got string literal 't work' [at 1:56]
INSERT INTO Test (IntVal, StrVal) VALUES (1, 'This won''t work')
                                                       ^ [Failed SQL: (3) INSERT INTO Test (IntVal, StrVal) VALUES (1, 'This won''t work')]

I've attached a full reproduction below.

liquibase-spanner-escaping-issue.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant