Skip to content

optimise json_get(...) is null to json_contains_not_null(...) #28

Open
@samuelcolvin

Description

We can't replace json_get(x, y) is null with NOT json_contains(x, y) because

select json_get('{"foo": null}', 'foo') is null  -- true
select not json_contains('{"foo": null}', 'foo')  -- false
-- or equivilantly
select json_get('{"foo": null}', 'foo') is not null  -- false
select json_contains('{"foo": null}', 'foo')  -- true

So we need a new method json_contains_not_null which is true if the value exists in the JSON, but is not null.

Then we can do the substitution.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions