So it happened that I forgot to include both ‘author’ and ‘id’ attributes in a change set.
{
“databaseChangeLog”: [
{
“changeSet”: {
“changes”: [
{ “sql”: "set session_authorization=pawel;
ALTER TABLE ONLY table1 ALTER COLUMN id SET DEFAULT nextval(‘table1_id_seq’::regclass);
SELECT setval(‘table1_id_seq’, max(id) + 10) FROM table1;
reset session authorization;
"
}
]
}
}
]
}
Liquibase error-ed out as expected with message:
Unexpected error running Liquibase: ERROR: null value in column “id” violates not-null constraint
Detail: Failing row contains (null, null, liquibase/pawel/some_update…, 2017-06-26 20:04:05.067686, 2, EXECUTED, 7:b169dadba628d406299d40596bf63325, sql, , null, 3.5.3, null, null, 8521845043).
but it did alter the table.
So as I understand it the content of the “sql” and insert into ‘databasechangelog’ were not executed in the same transaction.
What am I doing wrong?
Did I misunderstand meaning of “runInTransaction” attribute?
Cheers