Liquibase maven plugin: cannot find the databasechangelog table, PostgreSQL

Hi there, I have a problem running maven plugin org.liquibase:liquibase-maven-plugin:3.9.0 with Spring. I have a changelog file include all files from folder. When i start liquibase with this changeset - all things go perfect.
Liquibase Version: 3.10.1
Running Java under C:\Program Files\Java\jdk-11.0.7 (Version 11.0.7)
Driver: postgresql-42.2.11.jar

When i run the same changelog with maven with defined profiles in pom.xml with command
mvn liquibase:update -Pdev
i have an error:
“Execution default-cli of goal org.liquibase:liquibase-maven-plugin:3.9.0:update failed: liquibase.exception.DatabaseException: Error executing SQL SELECT MAX(ORDEREXECUTED) FROM databasechangelog: ERROR: relation “databasechangelog” does not exist”

Could some give me a some idea what could be a problem?

Hi @ned!

Welcome to the forum!

The error:

Indicates to me that liquibase is failing to find the databasechangelog table, which access to read or create is required.

Is the maven run targetting the same database the Springboot run of liquibase was?
Using the same user?

Thanks,

Ronak

Hi @ronak!
Yes, the same database with the same user.

The first changeset is executed. After it’s execution I have the messages:
SELECT MAX(ORDEREXECUTED) FROM databasechangelog
[INFO] Successfully released change log lock
[ERROR] Could not release lock
liquibase.exception.LockException: liquibase.exception.DatabaseException: Error executing SQL UPDATE databasechangeloglock SET LOCKED = FALSE, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1: ERROR: relation “databasechangeloglock” does not exist

I’ve checked in the database. The table “databasechangeloglock” is created. I think It couldn’t continue because the state in databasechangeloglock table column “locked” is true. The table databasechangelog is empty. It is not indicated that the first changeset is executed.

Greetings!

Hi @ned,

Hmm…it is true if there is a row in the databasechangeloglock table, then it indicates there is a lock. Perhaps the process got destroyed before liquibase could finish?

Have you tried deleting the row in databasechangeloglock table (leaving it empty) and running the liquibase update (via maven) again after that?

Thanks,

Ronak

@ronak

I’m experiencing the same behavior as @ned but on a completely fresh postgres db instance:

[INFO] ChangeSet liquibase/main.xml::1::smstromb ran successfully in 1828ms
[INFO] SELECT MAX(ORDEREXECUTED) FROM databasechangelog
[INFO] Successfully released change log lock
[ERROR] Could not release lock
liquibase.exception.LockException: liquibase.exception.DatabaseException: Error executing SQL UPDATE databasechangeloglock SET LOCKED = FALSE, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1: ERROR: relation “databasechangeloglock” does not exist

The databasechangeloglock and databasechangelog tables are created and the changset specified in the changelog is executed correctly, but it fails to find “databasechangeloglock” when attempting to remove the lock that it itself created. “databasechangelog” remains empty.

Running “UPDATE databasechangeloglock SET LOCKED = FALSE, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;” manually via psql does not return ERROR: relation “databasechangeloglock” does not exist.

Liquibase Version: 3.10.1
JDK-8
Driver: postgresql-42.2.14.jar

Yes, I’ve tried. I remove the first row and start again update. The same error.

Let me see if I can reproduce this error. Here’s what I am going to do, let me know @ned (or @smstromb) if you don’t have the same setup:

  • install Liquibase (my local system is a Mac, what are you using?)
  • Create a liquibase project (folder with liquibase.properties, changelog.xml)
  • make sure liquibase.properties is pointing to a postgres db (what version are you using?)
  • run a liquibase update and see if I get the databasechangeloglock table error.

Thanks,

Ronak

Hi @ronak !
My local system is Windows 10. Yes I created in src/main/resources folder liquibase. Add liquibase-dev.properties. Define profiles in pom.xml. liquibase.properties points to my local postgres database.
Use connector.changelog.xml in which I included two changelog’s.

Postgres Version 12
Liquibase Version: 3.10.1
Driver: postgresql-42.2.11.jar