Skip to content

Latest commit

 

History

History
9 lines (7 loc) · 393 Bytes

identify-null-json-values.md

File metadata and controls

9 lines (7 loc) · 393 Bytes

Idenfity NULL JSON Values

SELECT id, metadata FROM $TABLE_NAME
WHERE jsonb_typeof(metadata) != 'object'
OR jsonb_path_exists(metadata, '$.keyvalue() ? (@.value == null)')

Given a table, $TABLE_NAME, that possesses a JSONB column, metadata, the above query will return all rows in $TABLE_NAME where metadata is not NULL, but some value within metadata is NULL.