generateChangeLog fails when a column name in the database contains a parenthesis

Hello,

the Method AbstractDatabase.escapeColumnName() incorrectly assumes that column names that contain an opening parenthesis should not be quoted. I just tried to create a changelog from a SQL Server database that (for some very weird reasons) have a column named “Remote (flag)”.

Now in the method JdbcDatabaseSnapshotGenerator.isColumnAutoIncrement() the following SELECT statement will be created:

  1. SELECT Remote (flag)
  2. FROM FooTable
  3. WHERE 1=0

which obviously fails as there is no function called “Remote”. The column should have been fully quoted instead:

  1. SELECT "Remote (flag)"
  2. FROM FooTable
  3. WHERE 1=0
Now I full agree that having such a column name is more than just questionable, but still, it should have been treated correctly.

Liquibase 1.9 can generate a changeLog from that database. This only happens with 2.0.x