How to encode a cs query where the search value includes a closing parenthesis #3466
-
I want to search a JSON list for the string
results in
https://postgrest.org/en/v12/references/api/url_grammar.html#reserved-characters says that if
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
It looks like the parser is taking the
Yes, it means that the filter values should be surrounded in double quotation characters ( So, in your example, you should replace this:
With this:
Notice the need to escape the quotes As a side-note, you don't need to use the |
Beta Was this translation helpful? Give feedback.
It looks like the parser is taking the
)
from"foo=()"
as the end of theand
operator, hence the error:Token \"\"foo=(\" is invalid
.Yes, it means that the filter values should be surrounded in double quotation characters (
""
or%22%22
when encoded). In the case of thecs
operator, the filter value is everything that comes after that operator, e.g. forcol=cs.{a,b,c}
, then the value that should be wrapped in quotations is:{a,b,c}
(the whole array).So, in your example, you should replace this: