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
|
||||
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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user