I'm using MySql 5.5.37 and Liquibase 3.3. I have this stateemnt, which runs in the MySql termianl, but with warnings
mysql> update resource r set grade_id = convert(substring_index(substring_index(r.description, 'Grade ', -1), ' ', 1), unsigned integer) where r.description like '% Grade%' and CONVERT(SUBSTRING_INDEX(SUBSTRING_INDEX(r.description, 'Grade ',-1),' ',1),UNSIGNED) > 0;
Query OK, 0 rows affected, 7 warnings (0.03 sec)
Rows matched: 1333 Changed: 0 Warnings: 7
I don't care about the warnings, the main thing is taht it ran. However, when I run the same SQL in a LIquibase changeSet, the changeSet fails to execute with the error (which mirrors the warning from above) ...
DEBUG 3/8/17 7:44 PM: liquibase: /tmp/deploywork/db.changelog-master.xml: db.changelog-8.0.xml::link-ws-resources-to-right-workshop-products-proper-grades::davea: Executing EXECUTE database command: update resource r set grade_id = convert(substring_index(substring_index(r.description, 'Grade ', -1), ' ', 1), unsigned integer) where r.description like '% Grade%' and CONVERT(SUBSTRING_INDEX(SUBSTRING_INDEX(r.description, 'Grade ',-1),' ',1),UNSIGNED) > 0
SEVERE 3/8/17 7:44 PM: liquibase: /tmp/deploywork/db.changelog-master.xml: db.changelog-8.0.xml::link-ws-resources-to-right-workshop-products-proper-grades::davea: Change Set db.changelog-8.0.xml::link-ws-resources-to-right-workshop-products-proper-grades::davea failed. Error: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect INTEGER value: ''
liquibase.exception.DatabaseException: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect INTEGER value: ''
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:316)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:122)
at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1221)
at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1204)
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:550)
at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:43)
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:73)
at liquibase.Liquibase.update(Liquibase.java:200)
at liquibase.integration.commandline.Main.doMigration(Main.java:1032)
at liquibase.integration.commandline.Main.run(Main.java:177)
at liquibase.integration.commandline.Main.main(Main.java:96)
Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect INTEGER value: ''
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4094)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4028)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2490)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2651)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2728)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2678)
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:894)
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:732)
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:314)
How do I tell Liquibase to disregard warnings and execute the statement, failing only if there are genuine errors?