Liquibase issues with PostgreSQL

Tags: #<Tag:0x00007f01b974a3d0>

Hey everyone. I had been trying for some time to make OpenMRS-core run on PostgreSQL. I took some help from Support For PostgreSQL where @teleivo did some work.

Currently in the liquibase changesets where there is any precondition that checks for presence of Foreign Key, Primary Key or Indexes in tables, a precondition error is raised.

I am using PostgreSQL 12.2 with liquibase 2.0.5 currently being used in openmrs-core and have updated the PostgreSQL dependency to 42.2.8 .

Here is the link to the logs : https://pastebin.com/uzDCwpVH

Error corresponds to the changeset https://github.com/openmrs/openmrs-core/blob/b1c8d5be60b18498fa47b221cc59a785852ee8c0/api/src/main/resources/liquibase-update-to-2.0.xml#L1886-L1892

Initially I thought It was just with indexes so I ran the changes sets and created the indexes even if the error occurred. But then the same error came with foreign key and primary key preconditions as well.

Any advice or help is appreciated.

Without being able to really tell anything, my first suspicion is that our (very old) version of Liquibase doesn’t work with (very new) versions of Postgres. Is it possible to test with last Postgres 9.4 and the 9.4 version of the JDBC driver? Hopefully by the time GSoC starts in earnest, we’ll be closer to getting this merged and can rely on newer versions of things!

2 Likes

Thanks @ibacher for the info. I’ll look for Postgres 9.4 and give it a try.

The issue finally got resolved with PostgreSQL 9.4 with 9.3-1101-jdbc4 postgresql driver. :smiley:

One strange thing I observed though was that initially I tried with PostgreSQL 9.6 and with drivers 42.1.4 and 9.4.1212, error appeared randomly after executing certain number of changesets involving index or foreign key or primary key. A change set which might have failed in one execution got executed in another.

That’s a relief! I think Liquibase 2.0.5 (the version we use) was released in 2011 and… there have been some real evolutions to Postgres since then.