2.0 RC3 - Issues with commented SQL (inserts)

Hi Nathan,

Here is another thing I found in RC2 and also exists in RC3:

With this test.sql:

    insert into test_table values(1, 'hello'); insert into test_table values(2, 'hello'); --insert into test_table values(3, 'hello'); insert into test_table values(4, 'hello');

with this changeset:

                           
If you try to run it, it will fail, even if you put stripComments="true"

Could this be an issue?

On the other hand there was an issue in RC2 that it seems it was fixed in RC3:

    insert into test_table values(1, 'hello'); insert into test_table values(2, 'hello'); /*insert into test_table values(3, 'hello');*/ insert into test_table values(4, 'hello'); insert into test_table values(4, 'hello'); insert into test_table values(4, 'hello'); insert into test_table values(4, 'hello'); insert into test_table values(4, 'hello'); insert into test_table values(4, 'hello'); insert into test_table values(4, 'hello'); insert into test_table values(4, 'hello'); /* insert into test_table values(4, 'hello'); */ insert into test_table values(5, 'hello'); insert into test_table values(5, 'hello');

If you run this with RC2 none of the key with value 4 is inserted. And it didn’t run unless you put stripComments=“true”

Looks like http://liquibase.jira.com/browse/CORE-679

Try suggested workaround and waiting for fix :slight_smile:

Can this also be why my --rollback tag seems to be ignored in liquibase formatted sql?

It could be.  I’m looking at CORE-679 today, I’ll let you know when it’s fixed.

Nathan

I can’t replicate the issue (with the example in the issue, or yours) in trunk.  What OS are you running?

Nathan

Actually I found the issue.  It should be fixed in trunk now.

Nathan

Thanks Nathan for taking care of this problem, I have updated my local copy to revision 1668 but I still see the issue:

test:
    [exec] Aug 5, 2010 9:50:28 AM liquibase.logging.jvm.JavaUtilLogger info
    [exec] INFO: Successfully acquired change log lock
    [exec] Aug 5, 2010 9:50:29 AM liquibase.logging.jvm.JavaUtilLogger info
    [exec] INFO: Reading from DATABASECHANGELOG
    [exec] Aug 5, 2010 9:50:29 AM liquibase.logging.jvm.JavaUtilLogger info
    [exec] INFO: Reading from DATABASECHANGELOG
    [exec] Aug 5, 2010 9:50:29 AM liquibase.logging.jvm.JavaUtilLogger info
    [exec] INFO: Successfully released change log lock
    [exec] Liquibase Update Failed: Error executing SQL --insert into test_table values(2, ‘hello’).  For more information, use the --logLevel flag)
    [exec] Aug 5, 2010 9:50:29 AM liquibase.logging.jvm.JavaUtilLogger info
    [exec] INFO: Error executing SQL --insert into test_table values(2, ‘hello’)
    [exec] liquibase.exception.MigrationFailedException: Migration failed for change set test.xml::test-inserts::alexis:
    [exec]      Reason: liquibase.exception.DatabaseException: Error executing SQL --insert into test_table values(2, ‘hello’):
    [exec]          Caused By: Error executing SQL --insert into test_table values(2, ‘hello’):
    [exec]          Caused By: Invalid SQL type
    [exec] at liquibase.changelog.ChangeSet.execute(ChangeSet.java:286)
    [exec] at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:27)
    [exec] at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:39)
    [exec] at liquibase.Liquibase.update(Liquibase.java:109)
    [exec] at liquibase.integration.commandline.Main.doMigration(Main.java:672)
    [exec] at liquibase.integration.commandline.Main.main(Main.java:105)
    [exec] Caused by: liquibase.exception.DatabaseException: Error executing SQL --insert into test_table values(2, ‘hello’)
    [exec] at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:62)
    [exec] at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:97)
    [exec] at liquibase.database.AbstractDatabase.execute(AbstractDatabase.java:981)
    [exec] at liquibase.database.AbstractDatabase.executeStatements(AbstractDatabase.java:968)
    [exec] at liquibase.changelog.ChangeSet.execute(ChangeSet.java:257)
    [exec] … 5 more
    [exec] Caused by: java.sql.SQLException: Invalid SQL type
    [exec] at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
    [exec] at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)
    [exec] at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)
    [exec] at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:229)
    [exec] at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:403)
    [exec] at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:65)
    [exec] at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:936)
    [exec] at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1222)
    [exec] at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1770)
    [exec] at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1739)
    [exec] at oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:298)
    [exec] at liquibase.executor.jvm.JdbcExecutor$1ExecuteStatementCallback.doInStatement(JdbcExecutor.java:88)
    [exec] at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
    [exec] … 9 more

Try updating again.  I noticed this morning that I hadn’t actually hit “commit”…

Nathan

it doesn’t compile anymore :frowning:

It compiles for me, and everything appears to be checked in.  What is the compilation error?

Nathan

Sorry Nathan I should have said, it doesn’t build…

This is the log for: maven package target.

I see.  Darn tests :slight_smile:

I usually build with the intellij compiler and don’t always run the full test suite, I don’t have a good breakdown in the IDE to just run the fast tests.

They should be fixed now.

Nathan

hi Nathan… bad news it gives me an error with or without stripComments

test:
    [exec] Aug 5, 2010 2:48:20 PM liquibase.logging.jvm.JavaUtilLogger info
    [exec] INFO: Successfully acquired change log lock
    [exec] Aug 5, 2010 2:48:21 PM liquibase.logging.jvm.JavaUtilLogger info
    [exec] INFO: Reading from DATABASECHANGELOG
    [exec] Aug 5, 2010 2:48:21 PM liquibase.logging.jvm.JavaUtilLogger info
    [exec] INFO: Reading from DATABASECHANGELOG
    [exec] Aug 5, 2010 2:48:21 PM liquibase.logging.jvm.JavaUtilLogger info
    [exec] INFO: Successfully released change log lock
    [exec] Liquibase Update Failed: Error executing SQL --insert into test_table values(2, ‘hello’).  For more information, use the --logLevel flag)
    [exec] Aug 5, 2010 2:48:21 PM liquibase.logging.jvm.JavaUtilLogger info
    [exec] INFO: Error executing SQL --insert into test_table values(2, ‘hello’)
    [exec] liquibase.exception.MigrationFailedException: Migration failed for change set test.xml::test-inserts::alexis:
    [exec]      Reason: liquibase.exception.DatabaseException: Error executing SQL --insert into test_table values(2, ‘hello’):
    [exec]          Caused By: Error executing SQL --insert into test_table values(2, ‘hello’):
    [exec]          Caused By: Invalid SQL type
    [exec] at liquibase.changelog.ChangeSet.execute(ChangeSet.java:286)
    [exec] at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:27)
    [exec] at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:39)
    [exec] at liquibase.Liquibase.update(Liquibase.java:108)
    [exec] at liquibase.integration.commandline.Main.doMigration(Main.java:671)
    [exec] at liquibase.integration.commandline.Main.main(Main.java:105)
    [exec] Caused by: liquibase.exception.DatabaseException: Error executing SQL --insert into test_table values(2, ‘hello’)
    [exec] at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:62)
    [exec] at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:97)
    [exec] at liquibase.database.AbstractDatabase.execute(AbstractDatabase.java:982)
    [exec] at liquibase.database.AbstractDatabase.executeStatements(AbstractDatabase.java:969)
    [exec] at liquibase.changelog.ChangeSet.execute(ChangeSet.java:257)
    [exec] … 5 more
    [exec] Caused by: java.sql.SQLException: Invalid SQL type
    [exec] at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
    [exec] at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)
    [exec] at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)
    [exec] at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:229)
    [exec] at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:403)
    [exec] at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:65)
    [exec] at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:936)
    [exec] at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1222)
    [exec] at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1770)
    [exec] at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1739)
    [exec] at oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:298)
    [exec] at liquibase.executor.jvm.JdbcExecutor$1ExecuteStatementCallback.doInStatement(JdbcExecutor.java:88)
    [exec] at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
    [exec] … 9 more

BUILD FAILED

is it still failing with stripComments=false?

Nathan

Hi Nathan… yes sadly is still failling… I’m using the latest revision available (1703)

I tried with several options and I always get the same type of error…

    [exec] INFO: Error executing SQL --insert into test_table values(2, ‘hello’)
    [exec] liquibase.exception.MigrationFailedException: Migration failed for change set test.xml::test-inserts::alexis:
    [exec]      Reason: liquibase.exception.DatabaseException: Error executing SQL --insert into test_table values(2, ‘hello’):
    [exec]          Caused By: Error executing SQL --insert into test_table values(2, ‘hello’):
    [exec]          Caused By: Invalid SQL type

I think I may have found it.  The reason it kept seeming to work for me is because the databases I tested with didn’t care about statements that started with --'s. 

Could you test again from trunk?

Nathan

No luck… I’m using rev 1716 and is still failling :frowning:

You do need to use stripComments=“true”.  Otherwise the comments will be passed to the JDBC driver which apparently doesn’t like them.

Nathan

It worked… thanks a lot Nathan… I’m sorry but I don’t know why I didn’t put the stripComments :frowning: in my last test.

Glad it’s working.  Let me know if you run into any more problems.

Nathan