Dedicated Plan - Sql Query not returning results as expected

Aha - this is probably it! SimpleObject columns are presented (and stored) in Postgres’s JSONB type, and JSON can represent “null” separately from being an SQL “NULL”. Yes, it’s confusing, but it can actually carry meaning (eg “this key is not present in this object” vs “this key is present but null”). In Anvil’s case we generally want to make sure the key is present in our underlying data store in order to support indexed queries.

Does your query work if you compare the value with 'null'::jsonb (or even both, eg transfer_orders IS NOT NULL AND transfer_orders != 'null::JSOB`, although that shouldn’t be necessary)?

2 Likes