GenerateChangelog fails due to bad sql

I ran liquibase generateChangeLog command and it aborts after an SQL exception: Missing right paranthesis. Is there a way to check sql which caused this exception and any way to fix this?
the loglevel=debug shows the sql but not the one which is erraneous. The last logged SQL has no syntax issues.
Any help on this is appreciated.

Can you post the exception and stacktrace you are getting? Also, what version of Liquibase are you running?

Nathan

It looks like the query is coming from a select statement liquibase runs to determine if a column is auto-increment or not. It should be a simple “select X from Y where 0=1” query. I added logging of the statement in the code for 3.0.4, but I’m not sure what the problem would be now. The column names should be escaped as well, so it should even handle crazy columns or tables with "("s in them.


Any chance you have any strangely named tables or columns?

Nathan

I tried with Liquibase 3.0.0 and 3.0.2 but both give same result.

Following is the exception i got,

DEBUG 9/3/13 9:02 AM:liquibase: Executing QUERY database command: select uc.constraint_name, uc.table_name,uc.status,uc.deferrable,uc.deferred,ui.tablespace_name from all_constraints uc, all_cons_columns ucc, all_indexes ui where uc.constraint_type='U' and uc.index_name = ui.index_name and uc.constraint_name = ucc.constraint_name and uc.table_name = 'MTH_BOOK_ODTRUE_MKT_AGG_TR' and uc.owner = 'MDA' and ui.table_owner = 'MDA' and ucc.owner = 'MDA'

 

DEBUG 9/3/13 9:02 AM:liquibase: Executing QUERY database command: select uc.constraint_name, uc.table_name,uc.status,uc.deferrable,uc.deferred,ui.tablespace_name from all_constraints uc, all_cons_columns ucc, all_indexes ui where uc.constraint_type='U' and uc.index_name = ui.index_name and uc.constraint_name = ucc.constraint_name and uc.table_name = 'M_DIM_QUATER_BKP' and uc.owner = 'MDA' and ui.table_owner = 'MDA' and ucc.owner = 'MDA'

 

Liquibase generateChangeLog Failed: java.sql.SQLException: ORA-00907: missing right parenthesis

 

SEVERE 9/3/13 9:02 AM:liquibase: java.sql.SQLException: ORA-00907: missing right parenthesis

 

liquibase.exception.DatabaseException: java.sql.SQLException: ORA-00907: missing right parenthesis

 

        at liquibase.snapshot.jvm.ColumnSnapshotGenerator.snapshotObject(ColumnSnapshotGenerator.java:58)

        at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:59)

        at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:42)

        at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:75)

        at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:144)

        at liquibase.snapshot.DatabaseSnapshot.includeNestedObjects(DatabaseSnapshot.java:107)

        at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:94)

        at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:144)

        at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:157)

        at liquibase.snapshot.DatabaseSnapshot.includeNestedObjects(DatabaseSnapshot.java:107)

        at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:94)

        at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:124)

        at liquibase.snapshot.DatabaseSnapshot.includeNestedObjects(DatabaseSnapshot.java:107)

        at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:94)

        at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:124)

        at liquibase.snapshot.DatabaseSnapshot.includeNestedObjects(DatabaseSnapshot.java:107)

        at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:94)

        at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:144)

        at liquibase.snapshot.DatabaseSnapshot.includeNestedObjects(DatabaseSnapshot.java:107)

        at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:94)

        at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:124)

        at liquibase.snapshot.DatabaseSnapshot.includeNestedObjects(DatabaseSnapshot.java:107)

        at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:94)

        at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:144)

        at liquibase.snapshot.DatabaseSnapshot.includeNestedObjects(DatabaseSnapshot.java:107)

        at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:94)

        at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:144)

        at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:157)

        at liquibase.snapshot.DatabaseSnapshot.includeNestedObjects(DatabaseSnapshot.java:107)

        at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:94)

        at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:128)

        at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:121)

        at liquibase.integration.commandline.CommandLineUtils.doGenerateChangeLog(CommandLineUtils.java:155)

        at liquibase.integration.commandline.Main.doMigration(Main.java:775)

        at liquibase.integration.commandline.Main.main(Main.java:138)

Caused by: java.sql.SQLException: ORA-00907: missing right parenthesis

 

        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)

        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)

        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)

        at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745)

        at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:210)

        at oracle.jdbc.driver.T4CStatement.executeForDescribe(T4CStatement.java:804)

        at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1049)

        at oracle.jdbc.driver.T4CStatement.executeMaybeDescribe(T4CStatement.java:845)

        at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1154)

        at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1313)

        at liquibase.snapshot.jvm.ColumnSnapshotGenerator.readColumn(ColumnSnapshotGenerator.java:137)

        at liquibase.snapshot.jvm.ColumnSnapshotGenerator.snapshotObject(ColumnSnapshotGenerator.java:53)

        ... 34 more

Thanks