Unknown column 'ORDEREXECUTED' during upgrade

We sometimes see the following error when upgrading one of our databases. It seems to happen when we have a database that has had previous upgrades using liquibase 1.9.4 (and therefore ‘databasechangelog/lock’ tables created already) and then attempt an upgrade using liquibase 2.0.1.

An example error:

It should update just fine. What database types are you seeing the error on?


MySQL on Windows.

We have also had situations where we get two sets of change log tables - one set in upper case and one in lower case. This appears to happen if you create a MySQL database on Windows where it creates lower case table names and then take a database dump and restore it on a Linux box. 

I am not certain if this is strictly an issue between Windows and Linux with MySQL, or if liquibase has some code that is sometimes case sensitive and others not. It could also be a JDBC driver issue.

I do not know the upgrade logic in liquibase, but in the case where we take a MySQL database dump from Windows to Linux, it seems that liquibase upgrade ignores the lowercase table names and creates brand new upper case change log tables. However, then the the problem happens due to the logic in The lowercase table is the old version, and then an error occurs.

Our QA group has since said they can reproduce the error completely on Windows only. This would seem to indicate that maybe it is different versions of liquibase that were the cause of the lowercase and uppercase change log table names.

In fact, in the Windows only scenario, the QA group reports that they do not see the two sets of tables - just the one set in lowercase. The thought then is that liquibase 2.0 sees the lowercase tables (as it does not create a duplicate set in uppercase) but for some reason does not upgrade the lowercase versions - perhaps the upgrade code is case sensitive somehow, e.g. table names in quotes?

Hope this additional information might ring a bell or provide some additional clue as to what’s going on. Thanks.

The above was posted by djatnieks. I was not logged in when I replied.

Opened bug http://liquibase.jira.com/browse/CORE-980

I think I found the problem. The first method I’m calling after creating my Liquibase object is listUnrunChangeSets() and this method is missing a call to checkDatabaseChangeLogTable, e.g. the line in red is the missing code.

  1.     public List listUnrunChangeSets(String contexts) throws LiquibaseException {
  2.         changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, ","));

  3.         DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile, changeLogParameters, resourceAccessor);

  4.         checkDatabaseChangeLogTable(true, changeLog, contexts);

  5.         changeLog.validate(database, contexts);

  6.         ChangeLogIterator logIterator = getStandardChangelogIterator(contexts, changeLog);

  7.         ListVisitor visitor = new ListVisitor();
  8.         logIterator.run(visitor, database);
  9.         return visitor.getSeenChangeSets();
  10.     }

This is what is causing the exception.

Thanks for opening the bug, and helping track down the problem.