liquibase.exception.MigrationFailedException: Migration failed for change set master.xml::002::generated: Reason: master.xml : liquibase.precondition.core.PrimaryKeyExistsPrecondition@669251cc : Table 'liquibasetr.?nstallation' doesn't exist

JIRA | Ali Ok | 6 months ago
  1. 0

    It was reported initially here: https://issues.jboss.org/browse/AGPUSH-1623 For some reason, Liquibase is trying to convert table name to lowercase and then uppercase. {{Installation}} --> {{installation}} --> {{Installation}} It seems that first conversion is done with Locale.EN while second one is done with system language. So, in a Turkish machine, this happens: {{Installation}} --> {{installation}} --> {{─░nstallation}} Yes, that is a [dotted I|https://en.wikipedia.org/wiki/Dotted_and_dotless_I]. For this changeset: {code} <databaseChangeLog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd"> <changeSet id="001" author="generated" dbms="mysql"> <preConditions onFail="MARK_RAN"> <not> <tableExists tableName="Installation"/> </not> </preConditions> <createTable tableName="Installation"> <column name="id" type="VARCHAR(255)"> <constraints nullable="false"/> </column> <column name="alias" type="VARCHAR(255)"/> </createTable> </changeSet> <changeSet id="002" author="generated" dbms="mysql"> <preConditions onFail="MARK_RAN"> <not> <primaryKeyExists tableName="Installation"/> </not> </preConditions> <addPrimaryKey columnNames="id" constraintName="PRIMARY" tableName="Installation"/> </changeSet> </databaseChangeLog> {code} this is the log: {code} SEVERE 25.05.2016 22:05: liquibase: master.xml::002::generated: Precondition Error liquibase.exception.MigrationFailedException: Migration failed for change set master.xml::002::generated: Reason: master.xml : liquibase.precondition.core.PrimaryKeyExistsPrecondition@669251cc : Table 'liquibasetr.?nstallation' doesn't exist at liquibase.changelog.ChangeSet.execute(ChangeSet.java:514) 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:1044) at liquibase.integration.commandline.Main.run(Main.java:175) at liquibase.integration.commandline.Main.main(Main.java:94) Caused by: liquibase.exception.PreconditionErrorException: Precondition Error at liquibase.precondition.core.PrimaryKeyExistsPrecondition.check(PrimaryKeyExistsPrecondition.java:89) at liquibase.precondition.core.NotPrecondition.check(NotPrecondition.java:38) at liquibase.precondition.core.AndPrecondition.check(AndPrecondition.java:43) at liquibase.precondition.core.PreconditionContainer.check(PreconditionContainer.java:201) at liquibase.changelog.ChangeSet.execute(ChangeSet.java:471) ... 6 more Caused by: liquibase.exception.DatabaseException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'liquibasetr.?nstallation' doesn't exist at liquibase.snapshot.ResultSetCache.get(ResultSetCache.java:78) at liquibase.snapshot.JdbcDatabaseSnapshot$CachingDatabaseMetaData.getPrimaryKeys(JdbcDatabaseSnapshot.java:448) at liquibase.snapshot.jvm.PrimaryKeySnapshotGenerator.snapshotObject(PrimaryKeySnapshotGenerator.java:39) at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:60) at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:50) at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:163) at liquibase.snapshot.DatabaseSnapshot.init(DatabaseSnapshot.java:60) at liquibase.snapshot.DatabaseSnapshot.<init>(DatabaseSnapshot.java:37) at liquibase.snapshot.JdbcDatabaseSnapshot.<init>(JdbcDatabaseSnapshot.java:25) at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:126) at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:134) at liquibase.snapshot.SnapshotGeneratorFactory.has(SnapshotGeneratorFactory.java:88) at liquibase.precondition.core.PrimaryKeyExistsPrecondition.check(PrimaryKeyExistsPrecondition.java:79) ... 10 more Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'liquibasetr.?nstallation' doesn't exist at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.Util.getInstance(Util.java:386) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3609) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3541) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2002) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2163) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2618) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2568) at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1557) at com.mysql.jdbc.DatabaseMetaData$7.forEach(DatabaseMetaData.java:3967) at com.mysql.jdbc.IterateBlock.doForAll(IterateBlock.java:51) at com.mysql.jdbc.DatabaseMetaData.getPrimaryKeys(DatabaseMetaData.java:3951) at liquibase.snapshot.JdbcDatabaseSnapshot$CachingDatabaseMetaData$6.fastFetchQuery(JdbcDatabaseSnapshot.java:479) at liquibase.snapshot.ResultSetCache$SingleResultSetExtractor.fastFetch(ResultSetCache.java:282) at liquibase.snapshot.ResultSetCache.get(ResultSetCache.java:56) ... 22 more {code} See https://github.com/aliok/liquibase-turkish-bug for the instructions about how to reproduce. I tried with Liquibase core 3.3.2 and 3.5.1(latest). It happens on both versions.

    JIRA | 6 months ago | Ali Ok
    liquibase.exception.MigrationFailedException: Migration failed for change set master.xml::002::generated: Reason: master.xml : liquibase.precondition.core.PrimaryKeyExistsPrecondition@669251cc : Table 'liquibasetr.?nstallation' doesn't exist
  2. 0

    It was reported initially here: https://issues.jboss.org/browse/AGPUSH-1623 For some reason, Liquibase is trying to convert table name to lowercase and then uppercase. {{Installation}} --> {{installation}} --> {{Installation}} It seems that first conversion is done with Locale.EN while second one is done with system language. So, in a Turkish machine, this happens: {{Installation}} --> {{installation}} --> {{─░nstallation}} Yes, that is a [dotted I|https://en.wikipedia.org/wiki/Dotted_and_dotless_I]. For this changeset: {code} <databaseChangeLog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd"> <changeSet id="001" author="generated" dbms="mysql"> <preConditions onFail="MARK_RAN"> <not> <tableExists tableName="Installation"/> </not> </preConditions> <createTable tableName="Installation"> <column name="id" type="VARCHAR(255)"> <constraints nullable="false"/> </column> <column name="alias" type="VARCHAR(255)"/> </createTable> </changeSet> <changeSet id="002" author="generated" dbms="mysql"> <preConditions onFail="MARK_RAN"> <not> <primaryKeyExists tableName="Installation"/> </not> </preConditions> <addPrimaryKey columnNames="id" constraintName="PRIMARY" tableName="Installation"/> </changeSet> </databaseChangeLog> {code} this is the log: {code} SEVERE 25.05.2016 22:05: liquibase: master.xml::002::generated: Precondition Error liquibase.exception.MigrationFailedException: Migration failed for change set master.xml::002::generated: Reason: master.xml : liquibase.precondition.core.PrimaryKeyExistsPrecondition@669251cc : Table 'liquibasetr.?nstallation' doesn't exist at liquibase.changelog.ChangeSet.execute(ChangeSet.java:514) 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:1044) at liquibase.integration.commandline.Main.run(Main.java:175) at liquibase.integration.commandline.Main.main(Main.java:94) Caused by: liquibase.exception.PreconditionErrorException: Precondition Error at liquibase.precondition.core.PrimaryKeyExistsPrecondition.check(PrimaryKeyExistsPrecondition.java:89) at liquibase.precondition.core.NotPrecondition.check(NotPrecondition.java:38) at liquibase.precondition.core.AndPrecondition.check(AndPrecondition.java:43) at liquibase.precondition.core.PreconditionContainer.check(PreconditionContainer.java:201) at liquibase.changelog.ChangeSet.execute(ChangeSet.java:471) ... 6 more Caused by: liquibase.exception.DatabaseException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'liquibasetr.?nstallation' doesn't exist at liquibase.snapshot.ResultSetCache.get(ResultSetCache.java:78) at liquibase.snapshot.JdbcDatabaseSnapshot$CachingDatabaseMetaData.getPrimaryKeys(JdbcDatabaseSnapshot.java:448) at liquibase.snapshot.jvm.PrimaryKeySnapshotGenerator.snapshotObject(PrimaryKeySnapshotGenerator.java:39) at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:60) at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:50) at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:163) at liquibase.snapshot.DatabaseSnapshot.init(DatabaseSnapshot.java:60) at liquibase.snapshot.DatabaseSnapshot.<init>(DatabaseSnapshot.java:37) at liquibase.snapshot.JdbcDatabaseSnapshot.<init>(JdbcDatabaseSnapshot.java:25) at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:126) at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:134) at liquibase.snapshot.SnapshotGeneratorFactory.has(SnapshotGeneratorFactory.java:88) at liquibase.precondition.core.PrimaryKeyExistsPrecondition.check(PrimaryKeyExistsPrecondition.java:79) ... 10 more Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'liquibasetr.?nstallation' doesn't exist at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.Util.getInstance(Util.java:386) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3609) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3541) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2002) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2163) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2618) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2568) at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1557) at com.mysql.jdbc.DatabaseMetaData$7.forEach(DatabaseMetaData.java:3967) at com.mysql.jdbc.IterateBlock.doForAll(IterateBlock.java:51) at com.mysql.jdbc.DatabaseMetaData.getPrimaryKeys(DatabaseMetaData.java:3951) at liquibase.snapshot.JdbcDatabaseSnapshot$CachingDatabaseMetaData$6.fastFetchQuery(JdbcDatabaseSnapshot.java:479) at liquibase.snapshot.ResultSetCache$SingleResultSetExtractor.fastFetch(ResultSetCache.java:282) at liquibase.snapshot.ResultSetCache.get(ResultSetCache.java:56) ... 22 more {code} See https://github.com/aliok/liquibase-turkish-bug for the instructions about how to reproduce. I tried with Liquibase core 3.3.2 and 3.5.1(latest). It happens on both versions.

    JIRA | 6 months ago | Ali Ok
    liquibase.exception.MigrationFailedException: Migration failed for change set master.xml::002::generated: Reason: master.xml : liquibase.precondition.core.PrimaryKeyExistsPrecondition@669251cc : Table 'liquibasetr.?nstallation' doesn't exist
  3. 0

    [#CMP-701] TableToResourceMapping throws exception when fetching primary key for lowercase table names on MySQL - Compass JIRA

    compass-project.org | 11 months ago
    com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'jms.PERSON' doesn't exist
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Generate cross-schema foreign keys

    schemaspy | 8 years ago | daningaddr
    com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'test\_child.parent\_table' doesn't exist
  6. 0

    Release:Fuji Patch 12 Hot Fix 1 - ServiceNow Wiki

    servicenow.com | 8 months ago
    com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'junipernetworksstage_2.content_site' doesn't exist

  1. Kialandei 1 times, last 1 week ago
  2. MoYapro 1 times, last 1 week ago
  3. tvrmsmith 6 times, last 2 weeks ago
  4. linxiaolong 2 times, last 3 weeks ago
  5. DoktorDoener666 9 times, last 4 weeks ago
27 more registered users
68 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException

    Table 'liquibasetr.?nstallation' doesn't exist

    at sun.reflect.NativeConstructorAccessorImpl.newInstance0()
  2. Java RT
    Constructor.newInstance
    1. sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    2. sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    3. sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    4. java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    4 frames
  3. MySQL jdbc
    DatabaseMetaData.getPrimaryKeys
    1. com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
    2. com.mysql.jdbc.Util.getInstance(Util.java:386)
    3. com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052)
    4. com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3609)
    5. com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3541)
    6. com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2002)
    7. com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2163)
    8. com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2618)
    9. com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2568)
    10. com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1557)
    11. com.mysql.jdbc.DatabaseMetaData$7.forEach(DatabaseMetaData.java:3967)
    12. com.mysql.jdbc.IterateBlock.doForAll(IterateBlock.java:51)
    13. com.mysql.jdbc.DatabaseMetaData.getPrimaryKeys(DatabaseMetaData.java:3951)
    13 frames
  4. Liquibase Core
    Main.main
    1. liquibase.snapshot.JdbcDatabaseSnapshot$CachingDatabaseMetaData$6.fastFetchQuery(JdbcDatabaseSnapshot.java:479)
    2. liquibase.snapshot.ResultSetCache$SingleResultSetExtractor.fastFetch(ResultSetCache.java:282)
    3. liquibase.snapshot.ResultSetCache.get(ResultSetCache.java:56)
    4. liquibase.snapshot.JdbcDatabaseSnapshot$CachingDatabaseMetaData.getPrimaryKeys(JdbcDatabaseSnapshot.java:448)
    5. liquibase.snapshot.jvm.PrimaryKeySnapshotGenerator.snapshotObject(PrimaryKeySnapshotGenerator.java:39)
    6. liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:60)
    7. liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:50)
    8. liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:163)
    9. liquibase.snapshot.DatabaseSnapshot.init(DatabaseSnapshot.java:60)
    10. liquibase.snapshot.DatabaseSnapshot.<init>(DatabaseSnapshot.java:37)
    11. liquibase.snapshot.JdbcDatabaseSnapshot.<init>(JdbcDatabaseSnapshot.java:25)
    12. liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:126)
    13. liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:134)
    14. liquibase.snapshot.SnapshotGeneratorFactory.has(SnapshotGeneratorFactory.java:88)
    15. liquibase.precondition.core.PrimaryKeyExistsPrecondition.check(PrimaryKeyExistsPrecondition.java:79)
    16. liquibase.precondition.core.NotPrecondition.check(NotPrecondition.java:38)
    17. liquibase.precondition.core.AndPrecondition.check(AndPrecondition.java:43)
    18. liquibase.precondition.core.PreconditionContainer.check(PreconditionContainer.java:201)
    19. liquibase.changelog.ChangeSet.execute(ChangeSet.java:471)
    20. liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:43)
    21. liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:73)
    22. liquibase.Liquibase.update(Liquibase.java:200)
    23. liquibase.integration.commandline.Main.doMigration(Main.java:1044)
    24. liquibase.integration.commandline.Main.run(Main.java:175)
    25. liquibase.integration.commandline.Main.main(Main.java:94)
    25 frames