mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2026-08-17 16:34:44 -05:00
The SQL-standard body detection used a regex that matched 'return' anywhere in the body, so a plain SQL body containing a RETURNING clause (or an identifier like 'returned_value') was wrongly treated as a SQL-standard (BEGIN ATOMIC / RETURN) body. The generated CREATE OR REPLACE statement then dropped the AS $BODY$ ... $BODY$ wrapper, producing invalid SQL and a syntax error on save. Anchor the RETURN form to the start of the body so only genuine SQL-standard bodies are detected. Add unit tests for the detection. Closes #10059