The previous single-quote syntax with escaped quotes was split by split_sql_statements on semicolons inside the function body. Use $$ quoting to avoid quote escaping issues.