generateChangeLog fails using postgres when any column name is "default"

Hi everybody.

Theese are my first steps with liquibase and java at all. Trying to use liquibase in my project i’m unable to generate initial changelog - the problem is probably name of one of columns which is “default”. Table belongs to 3rd party app (django notification), and let’s assume it can not be changed. 

I use:

  • Liquibase Version: 2.0.1

  • postgresql-9.1

  • postgresql-9.1-901.jdbc3.jar postgresql-jdbc3-8.2.jar - no matter, problem remains

I’m getting following errors:

  1. Liquibase Update Failed: ERROR: syntax error at or near "default"
    SEVERE 05.03.12 12:44:liquibase: ERROR: syntax error at or near "default"
    liquibase.exception.DatabaseException: org.postgresql.util.PSQLException: ERROR: syntax error at or near "default"
    at liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.createSnapshot(
    at liquibase.snapshot.DatabaseSnapshotGeneratorFactory.createSnapshot(
    at liquibase.integration.commandline.CommandLineUtils.doGenerateChangeLog(
    at liquibase.integration.commandline.Main.doMigration(
    at liquibase.integration.commandline.Main.main(
    Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "default"
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(
    at org.postgresql.core.v3.QueryExecutorImpl.execute(
    at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(
    at liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.isColumnAutoIncrement(
    at liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.readColumns(
      at liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.createSnapshot( 5 more

Examining pg log i got:

  1. Mar 5 12:24:21 xxx postgres[13621]: [1044-1] ERROR: syntax error at or near “default” at character 8

  2. Mar 5 12:24:21 xxx postgres[13621]: [1044-2] STATEMENT: SELECT default FROM notification_noticetype WHERE 1 = 0

Query with double quoted column name passes OK returning 0 rows as expected.

Error semms to conform with

Any ideas?

Thanx in advance ;).

Some related stuff:

Default should be quoted but is not being. We had issues earlier when we automatically quoted everything in postgres which then makes everything case sensitive, then went to only quoting keywords but were too broad on our keyword list and still made some tables unexpectedly case sensitive. The current list is probably too likely to run into problems like you are seeing, however.

One option is to quote the table name in your changelog file ()

Otherewise, you can override the PostgresDatabase class’s isReservedWord() method using the extension system (

I’ll add default to the list of reserved postgres words, but that won’t go out until liquibase 3.0 which may be a month or more.