addAutoIncrement doesn't work for PostgreSQL

Trying to use addAutoIncrement (LiquiBase version 1.9.5) with PostgreSQL (8.4.0),

                                                                                                                                                                                                Auto increment the primary keys            

I have the following error :

    Reason: liquibase.exception.JDBCException: Error executing SQL ALTER TABLE cp1_table ALTER COLUMN  id SET DEFAULT 'cp1_table_id_seq':          Caused By: Error executing SQL ALTER TABLE cp1_table ALTER COLUMN  id SET DEFAULT 'cp1_table_id_seq':          Caused By: ERROR: invalid input syntax for integer: "cp1_table_id_seq"

Should be:

    ALTER TABLE cp1_table ALTER COLUMN  id SET DEFAULT NEXTVAL('cp1_table_id_seq')

A workaround is to use a native sql directive to define the changeSet, it works but …

                                                        Auto increment the primary keys (for PostgreSQL)                     CREATE SEQUENCE cp1_table_id_seq;           ALTER TABLE cp1_table alter COLUMN id set default nextval('cp1_table_id_seq');        

Remark: the autoIncrement attribute works correctly for a createTable.

Sorry for the slow reply.  I created an issue for this (http://liquibase.jira.com/browse/CORE-616) and will get it fixed for the 2.0 release.  You’ll have to use the work around for 1.9, or the modifySql tag to fix up the generated sql for postgres.

Nathan

Thanks