There is already an object named 'DATABASECHANGELOGLOCK' in the database when i update

Liquibase update Failed: liquibase.exception.DatabaseException: Error executing SQL CREATE TABLE [DATABASECHANGELOG

LOCK] ([ID] INT NOT NULL, [LOCKED] BIT NOT NULL, [LOCKGRANTED] datetime NULL, [LOCKEDBY] VARCHAR(255) NULL, CONSTRA

INT [PK_DATABASECHANGELOGLOCK] PRIMARY KEY ([ID])): There is already an object named ‘DATABASECHANGELOGLOCK’ in the

 database.


My changeset is 


 

  ALTER TABLE db.PROD_T_RESOURCE ADD address VARCHAR(255) NULL


The command i am using to generate is 


liquibase --driver=com.sybase.jdbc3.jdbc.SybDriver --classpath=<span --username=sa update

It looks like the code to detect the databasechangelogtable isn’t working correctly for some reason. What version of liquibase are you running?

Nathan

Hi all,


I just ran into the same problem using liquibase 3.1.0, while using 3.0.8 works. I attached a ZIP file containing a ready-to-run unit test demonstrating the issue (unzip and ‘mvn test’ will suffice). An in-memory HSQLDB is created and a trivial changeset is applied successfully for 3.0.8.


In the pom.xml you can change liquibase versions from 3.0.8 to 3.1.0 by switching comments in lines 13 and 16. In the latter case liquibase will throw a java.sql.SQLException: Table already exists: DATABASECHANGELOGLOCK in statement [CREATE TABLE PUBLIC.DATABASECHANGELOGLOCK].


I am aware that reporting issues directly in JIRA is preferred way, however I am not 100% sure if I did everything correct while using the Liquibase Core Java API. A Hibernate entity manager over HSQLDB 1.8 is encapsulating the connection object I am using to initialize the liquibase object and I hope this does not contribute to the issue. 



Thanks and regards


Kay