dolmios
04/08/2022, 2:52 AM'projects'
table, which is structured as an array` ["tom", "mike", ...]` and I'm trying to filter only rows which contain "mike"
(for example). How would this be achieved using the REST API?Scott P
04/08/2022, 3:11 AM&&
to search for a value (or array of values) against a column which contains an array of values - that's the overlap operator.
So, in PostgREST, this example seems relevant:
?period=ov.[2017-01-01,2017-06-30]
(from https://postgrest.org/en/stable/api.html#operators)
So, applying that to your use case, something like this:
?voters=ov.["tom", "mike"]
That should return any rows which have tom
or mike
in the voters
columndolmios
04/08/2022, 5:52 AMprojects?voters=ov.["tom", "mike"]
{
"message": "malformed array literal: \"[\"tom\", \"mike\"]\"",
"code": "22P02",
"details": "\"[\" must introduce explicitly-specified array dimensions.",
"hint": null
}
dolmios
04/08/2022, 6:30 AM?voters=cs.{mike, tom}
or
?voters=ov.{mike, tom}
Scott P
04/08/2022, 4:53 PM{}
instead of []