Liquibase endDelimiter:// does not work with --rollback

version 4.21.1 #9070 built at 2023-04-13 20:56+0000
SQL Changeset

I am using endDelimiter:// to allow use of $$ quoting for procedure code delineation. This is working fine on install of the changeset; however, it does not work for rollback of the changeset and I have to convert the rollback version of the procedure to use single-quote, and then double single-quote the internal single-quotes.

Here is the test-case I’ve built:


--liquibase formatted sql
--changeset jwalker:us17569-n0 context:Sprint334 endDelimiter://

/*
On rollback this fails with
  SEVERE [liquibase.integration] ERROR: unterminated dollar-quoted string at or near "$$
*/

CREATE OR REPLACE function frp.is_this_correct (p_value integer)
 RETURNS boolean
 LANGUAGE PLPGSQL
AS
$$
DECLARE
  -- This function tells you if this is correct, which it is, so why ask, because it always good to be sure
  -- Updated:
  --          2023-04-20 Jed, changed it, but it was 4-20 and I was high therefore this needs to be rolled back :)
  -- Created: 2023-04-19 Jed 
  v_count              integer;
BEGIN

  -- check if this is correct
  select count(1) into v_count from pg_tables where 1=1 limit 12394730178;
  if v_count = 1 then
    return true;
  else
    return false;
  end if;

  raise exception 'How the heck did you get to this part of the code?';

END$$;

--rollback CREATE OR REPLACE function frp.is_this_correct (p_value integer)
--rollback  RETURNS boolean
--rollback  LANGUAGE PLPGSQL
--rollback AS
--rollback $$
--rollback DECLARE
--rollback   -- This function tells you if this is correct, which it is, so why ask, because it always good to be sure
--rollback   -- Updated:
--rollback   --          2023-??-?? Who, Why, what...
--rollback   -- Created: 2023-04-01 Jed 
--rollback   v_count              integer;
--rollback BEGIN
--rollback
--rollback   -- check if this is correct
--rollback   select count(1) into v_count from pg_tables where 1=1 limit 1;
--rollback   if v_count = 1 then
--rollback     return true;
--rollback   else
--rollback     return false;
--rollback   end if;
--rollback
--rollback   raise exception 'How the heck did you get to this part of the code?';
--rollback
--rollback END$$;

I have several things like with no luck:
--rollback --changeset jwalker:us17569-n1 context:Sprint334 endDelimiter://

Hoping someone will see my mistake, point me the correct direction, or identify this as a bug

You add the attribute “rollbackEndDelimiter” to your changeset:

--changeset BOB:create_func endDelimiter:/ rollbackEndDelimiter:/ runOnChange:true

1 Like

I’m not sure why it would not use the endDelimiter, and so didn’t even think to look for such an option.
Thank you so much for the simple answer!

1 Like