Skip to content

How to encode a cs query where the search value includes a closing parenthesis #3466

Discussion options

You must be logged in to vote

It looks like the parser is taking the ) from "foo=()" as the end of the and operator, hence the error: Token \"\"foo=(\" is invalid.

https://postgrest.org/en/v12/references/api/url_grammar.html#reserved-characters says that if () characters are involved, I should surround something in %22 characters.

Yes, it means that the filter values should be surrounded in double quotation characters ( "" or %22%22 when encoded). In the case of the cs operator, the filter value is everything that comes after that operator, e.g. for col=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:

and=(column->jsonlist.cs…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by wolfgangwalther
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants