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

**URL:** <https://forum.liquibase.org/t/liquibase-for-postgresql-create-function-failing-with-unterminated-dollar-quote-exception/5076>\
**Category:** General Discussion\
**Created:** [February 16, 2021, 7:09pm UTC](https://forum.liquibase.org/t/liquibase-for-postgresql-create-function-failing-with-unterminated-dollar-quote-exception/5076 "2021-02-16T19:09:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![narendra.adapa](https://avatars.discourse-cdn.com/v4/letter/n/cab0a1/32.png) [@narendra.adapa](https://forum.liquibase.org/u/narendra.adapa)\
**Post date:** [February 16, 2021, 7:09pm UTC](https://forum.liquibase.org/t/liquibase-for-postgresql-create-function-failing-with-unterminated-dollar-quote-exception/5076/1 "2021-02-16T19:09:27Z")

</div>

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] –  
[ERROR] – $Id:function  
[ERROR] – Name: pr\_compare\_value\_lists  
[ERROR] –  
[ERROR] – Compare two lists of comma separated values to be used for ABAC  
[ERROR] –  
[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] –  
[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?

---

<div class="post-metadata">

**Author:** ![EduardUta](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.liquibase.org/eduarduta/32/324_2.png) [@EduardUta](https://forum.liquibase.org/u/EduardUta)\
**Post date:** [February 17, 2021, 8:41am UTC](https://forum.liquibase.org/t/liquibase-for-postgresql-create-function-failing-with-unterminated-dollar-quote-exception/5076/2 "2021-02-17T08:41:51Z")

</div>

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)).

Thanks,  
Eduard
