Closed gnusupport closed 2 years ago
GNU Support writes:
I do expect that library automatically escapes whatever is necessary when it comes to providing parameters.
parameters for the placeholders are transmitted seperately in the postgresql client protocol, so no escaping is needed.
Here below I get error as "+" is considered quantifier. Am I supposed to escape this before providing it as parameter?
No, but you're just supposed to provide a valid regular expression when using regular expression operators in your query :-)
Both, escaping "+" and not escaping it can yield a valid regular expression. E.g., 2+56 is valid and matches the string "222256", 2+56 is valid as well and matches the string "2+56". However, +256 is not a valid regular expression at all and that is what postgresql complains about here.
Details on regular expressions: https://www.postgresql.org/docs/current/functions-matching.html#FUNCTIONS-SIMILARTO-REGEXP
Alright, I was thinking library would handle it magically. Thanks.
I do expect that library automatically escapes whatever is necessary when it comes to providing parameters. Here below I get error as "+" is considered quantifier. Am I supposed to escape this before providing it as parameter?