I have a json query I'm making with postgrest, that I need to accept 2 scenarios.
either the value has to be equal to "failover" or it's null (doesn't exist).
If there wasn't JSON involved, this would be a simple or=(device_type.eq.failover,device_type.is.null)
however... For the life of me, I can't get a query with OR and JSON to work together...
event->labels->>device_type=eq.failover
That works fine for the first scenario.
event->labels->>device_type=is.null
works fine for the second scenario. But how do I combine them to an OR statement?
I've tried:
or=(event->labels->>device_type=is.null,event->labels->>device_type=eq.failover)
event->labels->>device_type=or(eq.failover,is.null)
event->labels->>device_type.or=(eq.failover,is.null)
But all of these just return a 400 bad request error...
Any idea how to combine a JSON match with an OR statement in postgrest?
The request should be:
or=(event->labels->>device_type.is.null,event->labels->>device_type.eq.failover)
Basically, use dot .
(instead of =
) as a separator inside the or
querystring param.