Looks like Liquibase had this issue a long time ago. We run our migration tests out of the latest mysql dockers for dev. The most resent update now gives the following error when setting a tag.
Error: Error executing SQL UPDATE xps_customer.DATABASECHANGELOG SET TAG = ‘v2.0.0’ WHERE DATEEXECUTED = (SELECT MAX(DATEEXECUTED) FROM (SELECT DATEEXECUTED FROM xps_customer.DATABASECHANGELOG) AS X): You can’t specify target table ‘DATABASECHANGELOG’ for update in FROM clause
liquibase.exception.DatabaseException: Error executing SQL UPDATE xps_customer.DATABASECHANGELOG SET TAG = ‘v2.0.0’ WHERE DATEEXECUTED = (SELECT MAX(DATEEXECUTED) FROM (SELECT DATEEXECUTED FROM xps_customer.DATABASECHANGELOG) AS X): You can’t specify target table ‘DATABASECHANGELOG’ for update in FROM clause
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:62)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:122)
at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1206)
at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1189)
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:528)
at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:43)
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:70)
at liquibase.Liquibase.update(Liquibase.java:195)
at liquibase.Liquibase.update(Liquibase.java:174)
at liquibase.integration.commandline.Main.doMigration(Main.java:997)
at liquibase.integration.commandline.Main.run(Main.java:170)
at liquibase.integration.commandline.Main.main(Main.java:89)
Caused by: java.sql.SQLException: You can’t specify target table ‘DATABASECHANGELOG’ for update in FROM clause
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1094)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4226)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4158)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2615)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2776)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2834)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2783)
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:908)
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:788)
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:310)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
… 11 more