sqlplsqlliquibaseliquibase-sql

Liquibase incorrectly reads "--" symbols inside SQL script


I have next Liquibase formatted SQL script with PL/SQL block.

--changeset TASK-NNN-create_new_tasks endDelimiter:\\
DECLARE
    email VARCHAR2(60) := 'some_person@example.com';
BEGIN
    CREATE_TASK(
        'new_task_1',
        'python task_executor.py --processor-name "new"',
        'New task 1',
        REPORT_TO => email
    );
    CREATE_TASK(
        'new_task_2',
        'python task_executor.py --processor-name "new_2"',
        'New task 2',
        REPORT_TO => email
    );
END;
\\

But Liquibase interpretates it incorrectly because of double dashes in the second argument values of CREATE_TASK function calling.

DECLARE
    email VARCHAR2(60) := 'some_person@example.com';
BEGIN
    CREATE_TASK(
        'new_task_1',
        'python task_executor.py 'New task 1',
        REPORT_TO => email
    );
    CREATE_TASK(
        'new_task_2',
        'python task_executor.py 'New task 2',
        REPORT_TO => email
    );
END;

What do I have to do so the argument would be valid?


Solution

  • I don't know why but Liquibase thinks that "--" inside value brackets is a comment start mark. Also found out that Liquibase shrinks comment sections by default.

    So I used "stripComments" option by disabling it and the new beginning of a script is next.

    --changeset TASK-NNN-create_new_tasks endDelimiter:\\ stripComments:false
    DECLARE
        email VARCHAR2(60) := 'some_person@example.com';
    ...
    

    After that SQL script proceeds as expected.