Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

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
Closed

Missed key access should return null instead of error #3

alx3apps opened this issue Oct 28, 2012 · 0 comments

Comments

@alx3apps
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants