liquibase version being used - org.liquibase:liquibase-core:3.8.2. (not pro version)
Liquibase documents (1 & 2) says below about splitStatements
(defaults to true)
Set to false to not have Liquibase split statements on ;'s and GO's. Defaults to true if not set
and
Removes Liquibase split statements on ;'s and GO's when it is set to false. Default value is: true.
Another useful sof post i found - In Liquibase is it OK to have an empty line on splitstatements?
I understand - when splitStatements is true, liquibase splits the statements on ;
and GO
- It not entirely clear what benefit
splitStatements
adds - i.e if SQL statement are split on;
(end delimiter) or not, what difference will it make - i.e if the statements are executed in a single query or multiple queries - won't the db handle the ";" based stuff anyway. This seems to be essential to understand. --could some one quote an example. - My current project has
splitStatements:false
. what advantages are we getting by disabling splitStatements. -any example would be greatly appreciated.
------------------------question expanded after answer from @user13579
below is an extract from a liquibase changelog file. This is what brought me to this question. It has splitStatements:false
and a ;
s in script and it works. With splitStatements:false
i would expect a error in this case and the answer I suppose also suggests an error in this case. The below is from production code so I am NOT sure how it works and the backend is POSTGREs. Can someone explain.
--liquibase formatted sql
--changeset adam:001-users-001 failOnError:true splitStatements:false logicalFilePath:001-users.sql
CREATE TABLE sys_users
(
user_id SERIAL,
first_name character varying(64) NOT NULL,
last_name character varying(64) NOT NULL,
email character varying(255) NOT NULL
)
WITH (
OIDS=FALSE
);
CREATE TABLE user_role
(
role_id SERIAL,
role_name character varying(255) NOT NULL,
description character varying(255) NOT NULL,
created_on timestamp(6) with time zone NOT NULL,
created_by character varying(64) NOT NULL,
)
WITH (
OIDS=FALSE
);