Liquibase for PostgreSQL - CREATE FUNCTION failing with Unterminated dollar quote exception

I’m using Liquibase to create function against PostgreSQL database and its failing with unterminated dollar sign. Please see the log below.

[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.8.0:update (run-liqubase) on project pgsql: Error setting up or running Liquibase: Migration failed for change set C:/workspaces/pgsql/pgsql/src/main/liquibase/sql/postgres.sql::01::Pega:
[ERROR] Reason: liquibase.exception.DatabaseException: Unterminated dollar quote started at position 1,202 in SQL CREATE FUNCTION pega_data_o.pr_compare_value_lists
[ERROR] – $Id:function
[ERROR] – Name: pr_compare_value_lists
[ERROR] – Compare two lists of comma separated values to be used for ABAC
[ERROR] – Date Who Description of Modification
[ERROR] – 12-Apr-2016 griba Initial version
[ERROR] – 28-Apr-2016 griba Added CLOB support
[ERROR] – For performance reasons, expect well formatted strings
[ERROR] (pp_list_one varchar(1000),
[ERROR] pp_list_two text,
[ERROR] pp_comparison_type varchar(30),
[ERROR] pp_list_one_null_result int,
[ERROR] pp_list_two_null_result int)
[ERROR] returns int
[ERROR] as
[ERROR] function
[ERROR] declare
[ERROR] lv_return int. Expected terminating $$ [Failed SQL: (0) CREATE FUNCTION pega_data_o.pr_compare_value_lists

Can someone please help to resolve this issue?

1 Like

Hi @narendra.adapa ,

From the error details this seems like a statement/batch terminator symbol related issue.
For better understanding it and the entire context, could you please add the function changelog (if it’s a separate .sql then add the sql β€œcalling” changelog/changeset and the beginning of the sql file (in case you may not want to share the actual code of the function)).