Case sensitive bug

Liquibase 1.9.5 on Windows against MS-SQL.

Liquibase is case insensitive on its arguments, so

liquibase --changeLogFile=casesensitive.xml update
liquibase --changeLogFile=CASESENSITIVE.xml update
will execute the same changelogfile.
The database is also case insensitive and will see the two nameings as the same.

If a changelog contains a changeset with attribute runAlways=“true”, running it using case different naming will raise an database exception.
So somewhere in the code there must be a case sensitive comparison that results in an INSERT statement where it should have been an UPDATE statement.

casesensitive.xml

    <?xml version="1.0" encoding="UTF-8"?> http://www.liquibase.org/xml/ns/dbchangelog/1.9"   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.9   http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd">
    <changeSet id="1" author="justx2" runAlways="true">
    	<comment>Doing nothing</comment>
    </changeSet>
    

Example:

liquibase --changeLogFile=casesensitive.xml update
Migration successful

liquibase --changeLogFile=casesensitive.xml update
Migration successful

liquibase --changeLogFile=CASESENSITIVE.xml update
Migration Failed: Violation of PRIMARY KEY constraint ‘PK_DATABASECHANGELOG’. Cannot insert duplicate key in object ‘dbo.DATABASECHANGELOG’…  For more information, use the --logLevel flag)
144  ERROR liquibase.main (111)  - Violation of PRIMARY KEY constraint ‘PK_DATABASECHANGELOG’. Cannot insert duplicate key in object ‘dbo.DATABASECHANGELOG’.
liquibase.exception.JDBCException: Error executing SQL INSERT INTO [dbo].[DATABASECHANGELOG] ([DATEEXECUTED], [AUTHOR], [LIQUIBASE], [DESCRIPTION], [COMMENTS], [MD5SUM], [ID], [FILENAME]) VALUES (GETDATE(), ‘justx2’, ‘1.9.5_ct1’, ‘Empty’, ‘Doing nothing’, ‘d41d8cd98f0b24e980998ecf8427e’, ‘1’, ‘CASESENSITIVE.xml’)
        at liquibase.database.template.JdbcTemplate.execute(JdbcTemplate.java:55)
        at liquibase.database.template.JdbcTemplate.execute(JdbcTemplate.java:86)
        at liquibase.database.AbstractDatabase.markChangeSetAsRan(AbstractDatabase.java:1309)
        at liquibase.parser.visitor.UpdateVisitor.visit(UpdateVisitor.java:28)
        at liquibase.parser.ChangeLogIterator.run(ChangeLogIterator.java:41)
        at liquibase.Liquibase.update(Liquibase.java:112)
        at liquibase.commandline.Main.doMigration(Main.java:650)
        at liquibase.commandline.Main.main(Main.java:97)
Caused by: java.sql.SQLException: Violation of PRIMARY KEY constraint ‘PK_DATABASECHANGELOG’. Cannot insert duplicate key in object ‘dbo.DATABASECHANGELOG’.
        at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368)
        at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2820)
        at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2258)
        at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:632)
        at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:584)
        at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:546)
        at net.sourceforge.jtds.jdbc.JtdsStatement.executeImpl(JtdsStatement.java:723)
        at net.sourceforge.jtds.jdbc.JtdsStatement.execute(JtdsStatement.java:1160)
        at liquibase.database.template.JdbcTemplate$1ExecuteStatementCallback.doInStatement(JdbcTemplate.java:78)
        at liquibase.database.template.JdbcTemplate.execute(JdbcTemplate.java:48)
        … 7 more

Thanks for the report.  I created an issue to track it: CORE-561

Nathan