Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Missed key access should return null instead of error #3

Closed
alx3apps opened this Issue Oct 28, 2012 · 0 comments

Comments

Projects
None yet
2 participants
Contributor

alx3apps commented Oct 28, 2012

This example should return NULL instead of throwing error:

select json_get_text('{"foo":"qq", "bar": true}', 'foo1');
ERROR:  cannot extract from "{"foo":"qq", "bar": true}" json object by the key "foo1"

****** Error **********

ERROR: cannot extract from "{"foo":"qq", "bar": true}" json object by the key "foo1"
SQL state: 428094

It's necessary for LIKE requests over JSON column with different structure.
It's debatable whether returning NULL anywhere is sane practice (I think not), but here it's not possible for SQL requests to handle this error.
Also, functions already declared as return null on null input (for performance reasons).
Also, legacy java implementation returns nulls on missed keys

reported by grey

@theirix theirix closed this in a888cc7 Oct 29, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment