target / goalert

Open source on-call scheduling, automated escalations, and notifications so you never miss a critical alert
https://goalert.me
Apache License 2.0
2.22k stars 240 forks source link

util/sqlutil: fix handling of block delimiters in SplitQuery #3775

Closed mastercactapus closed 6 months ago

mastercactapus commented 6 months ago

Description: The SplitQuery function wrongly assumed $$ was the only possible block delimiter, when it can be a user-defined tag like $foobar$

This PR fixes the bug and adds a test case for the more complex case.

More info: https://www.postgresql.org/docs/16/sql-syntax-lexical.html#SQL-SYNTAX-DOLLAR-QUOTING