If a column value contains a semicolon (`;`), it cannot be processed correctly
noda-sin opened this issue ยท 4 comments
In the code, the query is split using a semicolon (;
). Therefore, if a column value contains a semicolon, it could potentially break the query.
This issue was identified in the ticket below.
liquibase/liquibase-cassandra#258
Liquibase inserts strings separated by semicolons in the description into DATABASECHANGELOG
table when there are multiple changes within a changeset.
However, it can't process correctly since query is split in the middle.
error messages
Unexpected error running Liquibase: line 1:282 mismatched character '<EOF>' expecting ''' [Failed SQL: (0) INSERT INTO test.DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('create-tables', 'test', 'changelog.yml', 1703112425259, 1, '9:abd6cfa9eea355da8b0d16523bcc5115', 'sql; sql', '', 'EXECUTED', NULL, NULL, '4.25.0', '3112424168')]
Caused by: java.sql.SQLTransientException: com.datastax.oss.driver.api.core.servererrors.SyntaxError: line 1:282 mismatched character '<EOF>' expecting '''
cc @maximevw
maybe, this line intent to cure broken sql. but, not work properly.
maybe, this line intent to cure broken sql. but, not work properly.
Good point. The problem here is that code is not executed when the compliance mode "Liquibase" is active. So, I'll have to refactor the method doExecute(String)
to split the statements correctly and build a list of valid CQL queries before executing them regardless of the compliance mode.
Thank you @noda-sin for pointing this out.
Hello @noda-sin,
I released a version 4.11.1 to fix this issue. The artifact is also available in Maven Central.
A test with queries including semicolons in the inserted values has been added here and run both in default and Liquibase compliance modes. So, it seems now ok (the test indeed fails with the syntax error you mentioned when the fix is deactivated, but succeeds with the fix).
Please re-open this issue if the problem still persists.