I'm making some simple PostgREST queries on a table with network device properties. It seems that eq
and not.eq
both exclude null
values. I've learned that that's a “feature” of PostgreSQL, and can be worked around with the IS DISTINCT FROM
operator, which treats null
as a comparable value.
I can't find an equivalent (null-safe not-equals) operator in PostgREST. Is there one?
Simplified example:
# https://example.com/api?select=*&name=like.spam-*
[{
"name":"spam-eggs",
"type":"router",
"sector":"cheese"
},{
"name":"spam-ham",
"type":"router",
"sector":null
}]
not.eq.cheese
excludes cheese
and null
:
# https://example.com/api?select=*&name=like.spam-*§or=not.eq.cheese
[]
My awkward workaround is using or
to include null
s:
# https://example.com/api?select=*&name=like.spam-*&or=(sector.not.eq.cheese,sector.is.null)
[{
"name":"spam-ham",
"type":"router",
"sector":null
}]
Am I stuck with that workaround, or is there an operator like isdistinctfrom
, neq-or-null
, etc. that I've missed?