From 8e7f3b211e76a45efad21a569ad9a707e574e067 Mon Sep 17 00:00:00 2001 From: ZhenYi <434836402@qq.com> Date: Wed, 15 Apr 2026 11:31:40 +0800 Subject: [PATCH] fix: use dollar-quoting for PL/pgSQL trigger function 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. --- ...50628_000080_add_message_reactions_and_search.sql | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libs/migrate/sql/m20250628_000080_add_message_reactions_and_search.sql b/libs/migrate/sql/m20250628_000080_add_message_reactions_and_search.sql index 69e558d..f65db89 100644 --- a/libs/migrate/sql/m20250628_000080_add_message_reactions_and_search.sql +++ b/libs/migrate/sql/m20250628_000080_add_message_reactions_and_search.sql @@ -29,12 +29,12 @@ CREATE INDEX IF NOT EXISTS idx_room_message_content_tsv ON room_message USING GI -- Trigger to auto-update content_tsv on insert/update CREATE OR REPLACE FUNCTION room_message_tsv_trigger() RETURNS TRIGGER AS -' - BEGIN - NEW.content_tsv := to_tsvector(''simple'', COALESCE(NEW.content, '''')); - RETURN NEW; - END; -' LANGUAGE plpgsql; +$$ +BEGIN + NEW.content_tsv := to_tsvector('simple', COALESCE(NEW.content, '')); + RETURN NEW; +END; +$$ LANGUAGE plpgsql; CREATE TRIGGER room_message_tsv_update BEFORE INSERT OR UPDATE