liquibase.exception.MigrationFailedException: Migration failed for change set resources/liquibase/initialSchema/schema.xml::createIndex::dzmitry: Reason: resources/liquibase/liquibase.db.changelog.xml : Index Exists Precondition: Transaction_recordId : Comparisons between 'VARCHAR (UCS_BASIC)' and 'CHAR (TERRITORY_BASED:SECONDARY)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')

JIRA | Dzmitry Kazimirchyk | 2 years ago
  1. 0

    After upgrading from liquibase version 2.0.5 to 3.3.2 indexExists precondition stopped working for Derby databases using case insensitive mode. I've also tried other versions between 2.0.5 and 3.3.2 but it seems to be broken in all versions above 2.0.5. The error message I get is below: {noformat} liquibase.exception.MigrationFailedException: Migration failed for change set resources/liquibase/initialSchema/schema.xml::createIndex::dzmitry: Reason: resources/liquibase/liquibase.db.changelog.xml : Index Exists Precondition: Transaction_recordId : Comparisons between 'VARCHAR (UCS_BASIC)' and 'CHAR (TERRITORY_BASED:SECONDARY)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1') 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.Liquibase.update(Liquibase.java:181) ............................. at java.lang.Thread.run(Thread.java:745) Caused by: liquibase.exception.PreconditionErrorException: Precondition Error at liquibase.precondition.core.IndexExistsPrecondition.check(IndexExistsPrecondition.java:121) at liquibase.precondition.core.OrPrecondition.check(OrPrecondition.java:43) 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) ... 9 more {noformat}

    JIRA | 2 years ago | Dzmitry Kazimirchyk
    liquibase.exception.MigrationFailedException: Migration failed for change set resources/liquibase/initialSchema/schema.xml::createIndex::dzmitry: Reason: resources/liquibase/liquibase.db.changelog.xml : Index Exists Precondition: Transaction_recordId : Comparisons between 'VARCHAR (UCS_BASIC)' and 'CHAR (TERRITORY_BASED:SECONDARY)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
  2. 0

    After upgrading from liquibase version 2.0.5 to 3.3.2 indexExists precondition stopped working for Derby databases using case insensitive mode. I've also tried other versions between 2.0.5 and 3.3.2 but it seems to be broken in all versions above 2.0.5. The error message I get is below: {noformat} liquibase.exception.MigrationFailedException: Migration failed for change set resources/liquibase/initialSchema/schema.xml::createIndex::dzmitry: Reason: resources/liquibase/liquibase.db.changelog.xml : Index Exists Precondition: Transaction_recordId : Comparisons between 'VARCHAR (UCS_BASIC)' and 'CHAR (TERRITORY_BASED:SECONDARY)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1') 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.Liquibase.update(Liquibase.java:181) ............................. at java.lang.Thread.run(Thread.java:745) Caused by: liquibase.exception.PreconditionErrorException: Precondition Error at liquibase.precondition.core.IndexExistsPrecondition.check(IndexExistsPrecondition.java:121) at liquibase.precondition.core.OrPrecondition.check(OrPrecondition.java:43) 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) ... 9 more {noformat}

    JIRA | 2 years ago | Dzmitry Kazimirchyk
    liquibase.exception.MigrationFailedException: Migration failed for change set resources/liquibase/initialSchema/schema.xml::createIndex::dzmitry: Reason: resources/liquibase/liquibase.db.changelog.xml : Index Exists Precondition: Transaction_recordId : Comparisons between 'VARCHAR (UCS_BASIC)' and 'CHAR (TERRITORY_BASED:SECONDARY)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
  3. 0

    I have a change set that verifies if an Oracle view exists in another schema/catalog. I log in as my "liquibase" user who defaults to the "liquibase" schema. To reproduce the problem, I have the following change set that generates an error: {code:xml} <changeSet id="Test viewExists" author="test" dbms="oracle"> <preConditions onFailMessage="The USER_SDO_GEOM_METADATA does actually exist"> <viewExists viewName="USER_SDO_GEOM_METADATA" catalogName="MDSYS" schemaName="MDSYS" /> </preConditions> </changeSet> {code} I've tried setting either {{catalogName}} or {{schemaName}} to "MDSYS" without luck. The precondition always generates this SQL: {code:sql} SELECT TEXT FROM ALL_VIEWS WHERE upper(VIEW_NAME)='USER_SDO_GEOM_METADATA' AND OWNER='LIQUIBASE' {code} which results in this error: {code} DEBUG 1/18/15 9:24 AM: liquibase: add-column-create-index-drop-column.xml: add-column-create-index-drop-column.xml::Test viewExists::test: Running Changeset:add-column-create-index-drop-column.xml::Test viewExists::test DEBUG 1/18/15 9:24 AM: liquibase: add-column-create-index-drop-column.xml: add-column-create-index-drop-column.xml::Test viewExists::test: Changeset add-column-create-index-drop-column.xml::Test viewExists::test DEBUG 1/18/15 9:24 AM: liquibase: add-column-create-index-drop-column.xml: add-column-create-index-drop-column.xml::Test viewExists::test: Executing QUERY database command: SELECT TEXT FROM ALL_VIEWS WHERE upper(VIEW_NAME)='USER_SDO_GEOM_METADATA' AND OWNER='LIQUIBASE' SEVERE 1/18/15 9:24 AM: liquibase: add-column-create-index-drop-column.xml: add-column-create-index-drop-column.xml::Test viewExists::test: Change Set add-column-create-index-drop-column.xml::Test viewExists::test failed. Error: Migration failed for change set add-column-create-index-drop-column.xml::Test viewExists::test: Reason: add-column-create-index-drop-column.xml : liquibase.precondition.core.ViewExistsPrecondition@1a3938c5 : Empty result set, expected one row liquibase.exception.MigrationFailedException: Migration failed for change set add-column-create-index-drop-column.xml::Test viewExists::test: Reason: add-column-create-index-drop-column.xml : liquibase.precondition.core.ViewExistsPrecondition@1a3938c5 : Empty result set, expected one row 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.Liquibase.update(Liquibase.java:181) at liquibase.ext.spatial.LiquibaseIT.testLiquibaseUpdate(LiquibaseIT.java:183) at sun.reflect.GeneratedMethodAccessor268.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84) at org.testng.internal.Invoker.invokeMethod(Invoker.java:714) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111) at org.testng.TestRunner.privateRun(TestRunner.java:767) at org.testng.TestRunner.run(TestRunner.java:617) at org.testng.SuiteRunner.runTest(SuiteRunner.java:334) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291) at org.testng.SuiteRunner.run(SuiteRunner.java:240) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224) at org.testng.TestNG.runSuitesLocally(TestNG.java:1149) at org.testng.TestNG.run(TestNG.java:1057) at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175) Caused by: liquibase.exception.PreconditionErrorException: Precondition Error at liquibase.precondition.core.ViewExistsPrecondition.check(ViewExistsPrecondition.java:66) 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) ... 28 more Caused by: liquibase.exception.DatabaseException: Error getting jdbc:oracle:thin:@//192.168.0.21:1521/pdb2 view with liquibase.statement.core.GetViewDefinitionStatement@55336e6 at liquibase.snapshot.jvm.ViewSnapshotGenerator.snapshotObject(ViewSnapshotGenerator.java:95) at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:60) at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:50) at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:63) 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.ViewExistsPrecondition.check(ViewExistsPrecondition.java:60) ... 31 more Caused by: liquibase.exception.DatabaseException: Expected single row from liquibase.statement.core.GetViewDefinitionStatement@2ce17337 but got 0 at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:155) at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:166) at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:161) at liquibase.database.AbstractJdbcDatabase.getViewDefinition(AbstractJdbcDatabase.java:862) at liquibase.snapshot.jvm.ViewSnapshotGenerator.snapshotObject(ViewSnapshotGenerator.java:75) ... 43 more Caused by: liquibase.exception.DatabaseException: Empty result set, expected one row at liquibase.util.JdbcUtils.requiredSingleResult(JdbcUtils.java:141) at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:153) ... 47 more {code}

    JIRA | 2 years ago | Lonny Jacobson
    liquibase.exception.MigrationFailedException: Migration failed for change set add-column-create-index-drop-column.xml::Test viewExists::test: Reason: add-column-create-index-drop-column.xml : liquibase.precondition.core.ViewExistsPrecondition@1a3938c5 : Empty result set, expected one row
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Table exists precondition fails with the following exception: {code} DEBUG 3/20/15 4:12 PM: liquibase: <skipped> Executing QUERY database command: SELECT TEXT FROM ALL_VIEWS WHERE upper(VIEW_NAME)='*_<VIEW_NAME>_*' AND OWNER='_*<CURRENT_USER>*_' SEVERE 3/20/15 4:12 PM: liquibase: <skipped> Change Set <skipped> failed. Error: Migration failed for change set <skipped> Reason: <skipped> liquibase.precondition.core.TableExistsPrecondition@333f8b04 : Empty result set, expected one row liquibase.exception.MigrationFailedException: Migration failed for change set <skipped> Reason: <skipped> liquibase.precondition.core.TableExistsPrecondition@333f8b04 : Empty result set, expected one row at liquibase.changelog.ChangeSet.execute(ChangeSet.java:514) at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:50) at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:73) at liquibase.Liquibase.update(Liquibase.java:200) at org.liquibase.maven.plugins.LiquibaseUpdate.doUpdate(LiquibaseUpdate.java:33) at org.liquibase.maven.plugins.AbstractLiquibaseUpdateMojo.performLiquibaseTask(AbstractLiquibaseUpdateMojo.java:24) at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute(AbstractLiquibaseMojo.java:377) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216) at org.apache.maven.cli.MavenCli.main(MavenCli.java:160) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: liquibase.exception.PreconditionErrorException: Precondition Error at liquibase.precondition.core.TableExistsPrecondition.check(TableExistsPrecondition.java:65) 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) ... 27 more Caused by: liquibase.exception.DatabaseException: Error getting jdbc:oracle:thin:@<host>:<port>/<service_name> view with liquibase.statement.core.GetViewDefinitionStatement@13fabfb3 at liquibase.snapshot.jvm.ViewSnapshotGenerator.snapshotObject(ViewSnapshotGenerator.java:100) at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:60) at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:50) at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:63) at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:50) at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:189) at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:267) at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:289) at liquibase.snapshot.DatabaseSnapshot.includeNestedObjects(DatabaseSnapshot.java:221) at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:203) at liquibase.snapshot.DatabaseSnapshot.init(DatabaseSnapshot.java:70) at liquibase.snapshot.DatabaseSnapshot.<init>(DatabaseSnapshot.java:45) at liquibase.snapshot.JdbcDatabaseSnapshot.<init>(JdbcDatabaseSnapshot.java:25) at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:134) at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:123) at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:111) at liquibase.snapshot.SnapshotGeneratorFactory.has(SnapshotGeneratorFactory.java:101) at liquibase.precondition.core.TableExistsPrecondition.check(TableExistsPrecondition.java:59) ... 30 more Caused by: liquibase.exception.DatabaseException: Expected single row from liquibase.statement.core.GetViewDefinitionStatement@58815902 but got 0 at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:155) at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:166) at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:161) at liquibase.database.AbstractJdbcDatabase.getViewDefinition(AbstractJdbcDatabase.java:862) at liquibase.snapshot.jvm.ViewSnapshotGenerator.snapshotObject(ViewSnapshotGenerator.java:75) ... 47 more Caused by: liquibase.exception.DatabaseException: Empty result set, expected one row at liquibase.util.JdbcUtils.requiredSingleResult(JdbcUtils.java:141) at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:153) ... 51 more {code} Analysis showed that snapshot creation attempt was made during table existence check, and has eventually failed during attempt to get a View definition: {{liquibase.snapshot.jvm.ViewSnapshotGenerator.snapshotObject(DatabaseObject, DatabaseSnapshot)}}: {code} String rawViewName = row.getString("TABLE_NAME"); String rawSchemaName = StringUtils.trimToNull(row.getString("TABLE_SCHEM")); String rawCatalogName = StringUtils.trimToNull(row.getString("TABLE_CAT")); {code} After lines above are executed, {{rawSchemaName}} is <APPROPRIATE_VIEW_SCHEMA> and {{rawCatalogName}} is null. Next, View object itself is created: {code} View view = new View().setName(cleanNameFromDatabase(rawViewName, database)); view.setRemarks(remarks); CatalogAndSchema schemaFromJdbcInfo = ((AbstractJdbcDatabase) database).getSchemaFromJdbcInfo(rawCatalogName, rawSchemaName); view.setSchema(new Schema(schemaFromJdbcInfo.getCatalogName(), schemaFromJdbcInfo.getSchemaName())); {code} {{liquibase.database.AbstractJdbcDatabase.getSchemaFromJdbcInfo(String, String)}} calls {{liquibase.CatalogAndSchema.customize(Database)}} that eventually calls {{liquibase.CatalogAndSchema.standardize(Database)}}. This method considers catalog/schema names to be "in the wrong order" (Oracle does not support schemas while schema name is not null and catalog name is null) and swaps their values: {code} if (accordingTo.supportsSchemas()) { if (schemaName != null && schemaName.equalsIgnoreCase(accordingTo.getDefaultSchemaName())) { schemaName = null; } } else { if (catalogName == null && schemaName != null) { //had names in the wrong order catalogName = schemaName; } schemaName = catalogName; } {code} {{liquibase.CatalogAndSchema.customize(Database)}} also sets {{schemaName}} to the default value (<CURRENT_USER>): {code} public CatalogAndSchema customize(Database accordingTo) { CatalogAndSchema standard = standardize(accordingTo); String catalogName = standard.getCatalogName(); String schemaName = standard.getSchemaName(); <skipped> if (schemaName == null) { schemaName = accordingTo.getDefaultSchemaName(); } <skipped> return new CatalogAndSchema(catalogName, schemaName); } {code} Hence, catalog name becomes correct schema name and schema name becomes <CURRENT_USER>.{{liquibase.sqlgenerator.core.GetViewDefinitionGeneratorOracle.generateSql(GetViewDefinitionStatement, Database, SqlGeneratorChain)}} uses schema name (again, schemas are not supported by Oracle DB) instead of a catalog in its statement: {code} return new Sql[]{ new UnparsedSql("SELECT TEXT FROM ALL_VIEWS WHERE upper(VIEW_NAME)='" + statement.getViewName().toUpperCase() + "' AND OWNER='" + schema.getSchemaName() + "'") }; {code}

    JIRA | 2 years ago | Alexander Kiselyov
    liquibase.exception.MigrationFailedException: Migration failed for change set <skipped> Reason: <skipped> liquibase.precondition.core.TableExistsPrecondition@333f8b04 : Empty result set, expected one row
  6. 0

    I have a change set that verifies if an Oracle view exists in another schema/catalog. I log in as my "liquibase" user who defaults to the "liquibase" schema. To reproduce the problem, I have the following change set that generates an error: {code:xml} <changeSet id="Test viewExists" author="test" dbms="oracle"> <preConditions onFailMessage="The USER_SDO_GEOM_METADATA does actually exist"> <viewExists viewName="USER_SDO_GEOM_METADATA" catalogName="MDSYS" schemaName="MDSYS" /> </preConditions> </changeSet> {code} I've tried setting either {{catalogName}} or {{schemaName}} to "MDSYS" without luck. The precondition always generates this SQL: {code:sql} SELECT TEXT FROM ALL_VIEWS WHERE upper(VIEW_NAME)='USER_SDO_GEOM_METADATA' AND OWNER='LIQUIBASE' {code} which results in this error: {code} DEBUG 1/18/15 9:24 AM: liquibase: add-column-create-index-drop-column.xml: add-column-create-index-drop-column.xml::Test viewExists::test: Running Changeset:add-column-create-index-drop-column.xml::Test viewExists::test DEBUG 1/18/15 9:24 AM: liquibase: add-column-create-index-drop-column.xml: add-column-create-index-drop-column.xml::Test viewExists::test: Changeset add-column-create-index-drop-column.xml::Test viewExists::test DEBUG 1/18/15 9:24 AM: liquibase: add-column-create-index-drop-column.xml: add-column-create-index-drop-column.xml::Test viewExists::test: Executing QUERY database command: SELECT TEXT FROM ALL_VIEWS WHERE upper(VIEW_NAME)='USER_SDO_GEOM_METADATA' AND OWNER='LIQUIBASE' SEVERE 1/18/15 9:24 AM: liquibase: add-column-create-index-drop-column.xml: add-column-create-index-drop-column.xml::Test viewExists::test: Change Set add-column-create-index-drop-column.xml::Test viewExists::test failed. Error: Migration failed for change set add-column-create-index-drop-column.xml::Test viewExists::test: Reason: add-column-create-index-drop-column.xml : liquibase.precondition.core.ViewExistsPrecondition@1a3938c5 : Empty result set, expected one row liquibase.exception.MigrationFailedException: Migration failed for change set add-column-create-index-drop-column.xml::Test viewExists::test: Reason: add-column-create-index-drop-column.xml : liquibase.precondition.core.ViewExistsPrecondition@1a3938c5 : Empty result set, expected one row 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.Liquibase.update(Liquibase.java:181) at liquibase.ext.spatial.LiquibaseIT.testLiquibaseUpdate(LiquibaseIT.java:183) at sun.reflect.GeneratedMethodAccessor268.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84) at org.testng.internal.Invoker.invokeMethod(Invoker.java:714) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111) at org.testng.TestRunner.privateRun(TestRunner.java:767) at org.testng.TestRunner.run(TestRunner.java:617) at org.testng.SuiteRunner.runTest(SuiteRunner.java:334) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291) at org.testng.SuiteRunner.run(SuiteRunner.java:240) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224) at org.testng.TestNG.runSuitesLocally(TestNG.java:1149) at org.testng.TestNG.run(TestNG.java:1057) at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175) Caused by: liquibase.exception.PreconditionErrorException: Precondition Error at liquibase.precondition.core.ViewExistsPrecondition.check(ViewExistsPrecondition.java:66) 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) ... 28 more Caused by: liquibase.exception.DatabaseException: Error getting jdbc:oracle:thin:@//192.168.0.21:1521/pdb2 view with liquibase.statement.core.GetViewDefinitionStatement@55336e6 at liquibase.snapshot.jvm.ViewSnapshotGenerator.snapshotObject(ViewSnapshotGenerator.java:95) at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:60) at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:50) at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:63) 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.ViewExistsPrecondition.check(ViewExistsPrecondition.java:60) ... 31 more Caused by: liquibase.exception.DatabaseException: Expected single row from liquibase.statement.core.GetViewDefinitionStatement@2ce17337 but got 0 at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:155) at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:166) at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:161) at liquibase.database.AbstractJdbcDatabase.getViewDefinition(AbstractJdbcDatabase.java:862) at liquibase.snapshot.jvm.ViewSnapshotGenerator.snapshotObject(ViewSnapshotGenerator.java:75) ... 43 more Caused by: liquibase.exception.DatabaseException: Empty result set, expected one row at liquibase.util.JdbcUtils.requiredSingleResult(JdbcUtils.java:141) at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:153) ... 47 more {code}

    JIRA | 2 years ago | Lonny Jacobson
    liquibase.exception.MigrationFailedException: Migration failed for change set add-column-create-index-drop-column.xml::Test viewExists::test: Reason: add-column-create-index-drop-column.xml : liquibase.precondition.core.ViewExistsPrecondition@1a3938c5 : Empty result set, expected one row

    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. liquibase.exception.MigrationFailedException

      Migration failed for change set resources/liquibase/initialSchema/schema.xml::createIndex::dzmitry: Reason: resources/liquibase/liquibase.db.changelog.xml : Index Exists Precondition: Transaction_recordId : Comparisons between 'VARCHAR (UCS_BASIC)' and 'CHAR (TERRITORY_BASED:SECONDARY)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')

      at liquibase.changelog.ChangeSet.execute()
    2. Liquibase Core
      Liquibase.update
      1. liquibase.changelog.ChangeSet.execute(ChangeSet.java:514)
      2. liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:43)
      3. liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:73)
      4. liquibase.Liquibase.update(Liquibase.java:200)
      5. liquibase.Liquibase.update(Liquibase.java:181)
      5 frames