PostgreSQL 12 Support

Hello Experts

Does liquibase support Postgres 12?

I am getting the following error when I run liquibase with Postgres 12.

column “adsrc” does not exist

What’s the way forward?

Best
Sumit

1 Like

Hello @SumitBhardwaj, and welcome!

Could you provide some more info so that we can help determine if this is a bug? Could you provide the liquibase command you are executing and the contents of the changelog you are using.

Thanks!
Kristyl

Hi Kristyl,

Thanks for your reply.

FYI, we have used version postgres 9.5, 11.3, and did not face this issue. Started seeing this issues while testing for 12.x.

We are using the following change set where it’s failing with the error, more stack is at the end of the email.

Best
Sumit

classpath:sql/liquibase/changelog.xml : liquibase.precondition.core.SequenceExistsPrecondition@f54bb86 : ERROR: column “adsrc” does not exist

Caused by: liquibase.exception.MigrationFailedException: Migration failed for change set

The table was created using the following changeset.

Error Stack

Caused by: liquibase.exception.PreconditionErrorException: Precondition Error
at liquibase.precondition.core.SequenceExistsPrecondition.check(SequenceExistsPrecondition.java:63) ~[liquibase-core-3.2.2.jar:?]
at liquibase.precondition.core.AndPrecondition.check(AndPrecondition.java:43) ~[liquibase-core-3.2.2.jar:?]
at liquibase.precondition.core.PreconditionContainer.check(PreconditionContainer.java:201) ~[liquibase-core-3.2.2.jar:?]
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:449) ~[liquibase-core-3.2.2.jar:?]
at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:43) ~[liquibase-core-3.2.2.jar:?]
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:70) ~[liquibase-core-3.2.2.jar:?]
at liquibase.Liquibase.update(Liquibase.java:195) ~[liquibase-core-3.2.2.jar:?]
at liquibase.Liquibase.update(Liquibase.java:174) ~[liquibase-core-3.2.2.jar:?]
at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:345) ~[liquibase-core-3.2.2.jar:?]
at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:302) ~[liquibase-core-3.2.2.jar:?]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1765) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1702) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
… 60 more
Caused by: liquibase.exception.DatabaseException: Error executing SQL SELECT relname AS SEQUENCE_NAME FROM pg_class, pg_namespace WHERE relkind=‘S’ AND pg_class.relnamespace = pg_namespace.oid AND nspname = ‘null’ AND ‘nextval(’‘null.’||relname||’’’::regclass)’ not in (select adsrc from pg_attrdef where adsrc is not null) AND ‘nextval(’‘null."’||relname||’"’’::regclass)’ not in (select adsrc from pg_attrdef where adsrc is not null) AND ‘nextval(’’’||relname||’’’::regclass)’ not in (select adsrc from pg_attrdef where adsrc is not null)AND ‘nextval(’’"’||relname||’"’’::regclass)’ not in (select adsrc from pg_attrdef where adsrc is not null): ERROR: column “adsrc” does not exist
Position: 208
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:62) ~[liquibase-core-3.2.2.jar:?]
at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:135) ~[liquibase-core-3.2.2.jar:?]
at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:143) ~[liquibase-core-3.2.2.jar:?]
at liquibase.executor.jvm.JdbcExecutor.queryForList(JdbcExecutor.java:205) ~[liquibase-core-3.2.2.jar:?]
at liquibase.executor.jvm.JdbcExecutor.queryForList(JdbcExecutor.java:199) ~[liquibase-core-3.2.2.jar:?]
at liquibase.snapshot.jvm.SequenceSnapshotGenerator.snapshotObject(SequenceSnapshotGenerator.java:59) ~[liquibase-core-3.2.2.jar:?]
at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:59) ~[liquibase-core-3.2.2.jar:?]
at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:50) ~[liquibase-core-3.2.2.jar:?]
at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:153) ~[liquibase-core-3.2.2.jar:?]
at liquibase.snapshot.DatabaseSnapshot.init(DatabaseSnapshot.java:56) ~[liquibase-core-3.2.2.jar:?]
at liquibase.snapshot.DatabaseSnapshot.(DatabaseSnapshot.java:33) ~[liquibase-core-3.2.2.jar:?]
at liquibase.snapshot.JdbcDatabaseSnapshot.(JdbcDatabaseSnapshot.java:22) ~[liquibase-core-3.2.2.jar:?]
at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:126) ~[liquibase-core-3.2.2.jar:?]
at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:134) ~[liquibase-core-3.2.2.jar:?]
at liquibase.snapshot.SnapshotGeneratorFactory.has(SnapshotGeneratorFactory.java:88) ~[liquibase-core-3.2.2.jar:?]
at liquibase.precondition.core.SequenceExistsPrecondition.check(SequenceExistsPrecondition.java:59) ~[liquibase-core-3.2.2.jar:?]
at liquibase.precondition.core.AndPrecondition.check(AndPrecondition.java:43) ~[liquibase-core-3.2.2.jar:?]
at liquibase.precondition.core.PreconditionContainer.check(PreconditionContainer.java:201) ~[liquibase-core-3.2.2.jar:?]
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:449) ~[liquibase-core-3.2.2.jar:?]
at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:43) ~[liquibase-core-3.2.2.jar:?]
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:70) ~[liquibase-core-3.2.2.jar:?]
at liquibase.Liquibase.update(Liquibase.java:195) ~[liquibase-core-3.2.2.jar:?]
at liquibase.Liquibase.update(Liquibase.java:174) ~[liquibase-core-3.2.2.jar:?]
at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:345) ~[liquibase-core-3.2.2.jar:?]
at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:302) ~[liquibase-core-3.2.2.jar:?]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1765) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1702) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
… 60 more
Caused by: org.postgresql.util.PSQLException: ERROR: column “adsrc” does not exist
Position: 208
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440) ~[postgresql-42.2.5.jar:42.2.5]
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183) ~[postgresql-42.2.5.jar:42.2.5]
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:308) ~[postgresql-42.2.5.jar:42.2.5]
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441) ~[postgresql-42.2.5.jar:42.2.5]
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365) ~[postgresql-42.2.5.jar:42.2.5]
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:307) ~[postgresql-42.2.5.jar:42.2.5]
at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:293) ~[postgresql-42.2.5.jar:42.2.5]
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:270) ~[postgresql-42.2.5.jar:42.2.5]
at org.postgresql.jdbc.PgStatement.executeQuery(PgStatement.java:224) ~[postgresql-42.2.5.jar:42.2.5]
at com.mchange.v2.c3p0.impl.NewProxyStatement.executeQuery(NewProxyStatement.java:327) ~[c3p0-0.9.5.2.jar:0.9.5.2]
at liquibase.executor.jvm.JdbcExecutor$QueryStatementCallback.doInStatement(JdbcExecutor.java:348) ~[liquibase-core-3.2.2.jar:?]
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55) ~[liquibase-core-3.2.2.jar:?]
at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:135) ~[liquibase-core-3.2.2.jar:?]
at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:143) ~[liquibase-core-3.2.2.jar:?]
at liquibase.executor.jvm.JdbcExecutor.queryForList(JdbcExecutor.java:205) ~[liquibase-core-3.2.2.jar:?]
at liquibase.executor.jvm.JdbcExecutor.queryForList(JdbcExecutor.java:199) ~[liquibase-core-3.2.2.jar:?]
at liquibase.snapshot.jvm.SequenceSnapshotGenerator.snapshotObject(SequenceSnapshotGenerator.java:59) ~[liquibase-core-3.2.2.jar:?]
at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:59) ~[liquibase-core-3.2.2.jar:?]
at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:50) ~[liquibase-core-3.2.2.jar:?]
at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:153) ~[liquibase-core-3.2.2.jar:?]
at liquibase.snapshot.DatabaseSnapshot.init(DatabaseSnapshot.java:56) ~[liquibase-core-3.2.2.jar:?]
at liquibase.snapshot.DatabaseSnapshot.(DatabaseSnapshot.java:33) ~[liquibase-core-3.2.2.jar:?]
at liquibase.snapshot.JdbcDatabaseSnapshot.(JdbcDatabaseSnapshot.java:22) ~[liquibase-core-3.2.2.jar:?]
at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:126) ~[liquibase-core-3.2.2.jar:?]
at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:134) ~[liquibase-core-3.2.2.jar:?]
at liquibase.snapshot.SnapshotGeneratorFactory.has(SnapshotGeneratorFactory.java:88) ~[liquibase-core-3.2.2.jar:?]
at liquibase.precondition.core.SequenceExistsPrecondition.check(SequenceExistsPrecondition.java:59) ~[liquibase-core-3.2.2.jar:?]
at liquibase.precondition.core.AndPrecondition.check(AndPrecondition.java:43) ~[liquibase-core-3.2.2.jar:?]
at liquibase.precondition.core.PreconditionContainer.check(PreconditionContainer.java:201) ~[liquibase-core-3.2.2.jar:?]
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:449) ~[liquibase-core-3.2.2.jar:?]
at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:43) ~[liquibase-core-3.2.2.jar:?]
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:70) ~[liquibase-core-3.2.2.jar:?]
at liquibase.Liquibase.update(Liquibase.java:195) ~[liquibase-core-3.2.2.jar:?]
at liquibase.Liquibase.update(Liquibase.java:174) ~[liquibase-core-3.2.2.jar:?]
at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:345) ~[liquibase-core-3.2.2.jar:?]
at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:302) ~[liquibase-core-3.2.2.jar:?]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1765) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1702) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
… 60 more

Hi Kristyl,

Looks like replying by mail removed the changesets.

Adding them here again.

Best
Sumit

changeset where its failing

                            <preConditions onFail="MARK_RAN">

                                            <tableExists tableName="mytable"/>

                            </preConditions>

                            <dropTable tableName="mytable" cascadeConstraints="true"/>

            </changeSet>

           

            <changeSet logicalFilePath="c021_drop_mytable_table.xml" author="XXXXX" id="dropmytableTableSequence">

                            <preConditions onFail="MARK_RAN">

                                            <sequenceExists sequenceName="mytable_id_seq"/>

                            </preConditions>

                            <dropSequence sequenceName="mytable_id_seq"/>

            </changeSet>

The table was created using the following changeset.

    <preConditions onFail="MARK_RAN">

        <not>

            <tableExists tableName="mytable" />

        </not>

    </preConditions>

    <createTable tableName="mytable">

        <column name="id" type="INT" >

            <constraints primaryKey="true" />

        </column>

        <column name="C1" type="INT" />

        <column name="C2" type="VARCHAR(64)" />

        <column name="C3" type="VARCHAR(64)" />

        <column name="C4" type="DATETIME" />

    </createTable>

</changeSet>

Hi @SumitBhardwaj,

Thank you for responding with more detail. It looks like you have found an issue specific to postgres version 12. Could you file a bug using our GitHub form here : https://github.com/liquibase/liquibase/issues/new?assignees=&labels=Status%3ADiscovery&template=bug_report.md&title=

One of our Liquibase support engineers will then follow up on the issue.

Thanks!
Kristyl