Issue details:
We used to define a change-set for creating a table having a column of type SERIAL and that column would also act as a primary key and set autoIncrement to true. The earlier behavior noted until liquibase 3.6.3 was that it would create a table in Postgres with a column of type INT and at the same time would initialize a sequence of name tablename_serialcol_seq . Now with the new liquibase version 3.8.9, liquibase creates a table with a column as INT (SERIAL → INT), however does not creates a sequence with the name tablename_serialcol_seq instead it just adds a sequence definition in the DDL.
Example change-set:
- changeSet:
id: 709
author: abc
changes:- createTable:
columns:- column:
autoIncrement: true
constraints:
primaryKey: true
primaryKeyName: sample_pkey
name: sample_sk
type: SERIAL - column:
constraints:
nullable: false
name: source_column_sk
type: INTEGER
tableName: tab1
- column:
- createTable:
This change-set with version 3.6.3 would create a sequence named tab1_sample_sk_seq, however with version 3.8.9 it does not rather it generates a SQL like,
sample_sk integer NOT NULL GENERATED BY DEFAULT AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 )
Even when we try to alter the table to point to a sequence so that we can access the sequence with a name in our hibernate mapping, liquibase does not allow the alter.
- changeSet:
id: 711
author: abc
changes:-
addDefaultValue :
columnName: sample_sk
defaultValueSequenceNext : tab1_sample_sk_seq
tableName: tab1
-
addDefaultValue :
It fails with the below error,
ERROR: column “sample_sk” of relation “tab1” is an identity column [Failed SQL: (0) ALTER TABLE tabl1 ALTER COLUMN sample_sk SET DEFAULT nextval(‘tab1_sample_sk_seq’)]"
Let us know whether there is any change in behavior for type SERIAL and if so, how to fix it or at least alter the table to set a default sequence with a fixed name. The expectation is that the existing liquibase change-set should have not failed by upgrading liquibase.