This is second part of the "write proper SQL queries" campaign. Queries that return more than one value will result in "500 Internal Server Error" response.
This is more general approach, which forces writing proper SQL queries instead of filtering results on the nginx side and allows for sending output from multiple rows to end-users. Discussed with Silly Sad.
It is now possible to: - escape variable in-place, - escape both anonymous and named regex captures, - safely re-use same $escaped variable name in different locations, - concatenate multiple variables/strings and escape them into single variable. All this comes at the price of not being able to tell the difference between empty string and non-existing value, which means that starting with this commit all empty strings will be escaped to NULL value. This behavior can be disabled by prefixing unescaped value with '=' sign.
… "postgres_rewrite" directive.