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.
This commit is contained in:
parent
b6697258ab
commit
8e7f3b211e
@ -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
|
-- Trigger to auto-update content_tsv on insert/update
|
||||||
CREATE OR REPLACE FUNCTION room_message_tsv_trigger() RETURNS TRIGGER AS
|
CREATE OR REPLACE FUNCTION room_message_tsv_trigger() RETURNS TRIGGER AS
|
||||||
'
|
$$
|
||||||
BEGIN
|
BEGIN
|
||||||
NEW.content_tsv := to_tsvector(''simple'', COALESCE(NEW.content, ''''));
|
NEW.content_tsv := to_tsvector('simple', COALESCE(NEW.content, ''));
|
||||||
RETURN NEW;
|
RETURN NEW;
|
||||||
END;
|
END;
|
||||||
' LANGUAGE plpgsql;
|
$$ LANGUAGE plpgsql;
|
||||||
|
|
||||||
CREATE TRIGGER room_message_tsv_update
|
CREATE TRIGGER room_message_tsv_update
|
||||||
BEFORE INSERT OR UPDATE
|
BEFORE INSERT OR UPDATE
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user