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

Non-existing path OR NULL from JSONB is treated as empty object #3085

Closed
dmiwell opened this issue Oct 27, 2023 · 4 comments
Closed

Non-existing path OR NULL from JSONB is treated as empty object #3085

dmiwell opened this issue Oct 27, 2023 · 4 comments
Labels

Comments

@dmiwell
Copy link

dmiwell commented Oct 27, 2023

After upgrading from 8.11.1 -> 8.11.3, the following happens:

id col
1 {}
SELECT col->'path' FROM any WHERE id = 1

results to {} instead of null. For 8.11.1 it is correct and null. '{}' is passed to JSONB type parser resulting with {}.

@charmander
Copy link
Collaborator

This sounds like #3062, but that particular example wouldn’t trigger it. Do you actually have multiple columns with the same name?

@dmiwell
Copy link
Author

dmiwell commented Oct 30, 2023

No, it's not related to the same name. The only issue I faced with, that is described above, is returning {} instead of null when non-existing JSONB path is requested.

@dmiwell
Copy link
Author

dmiwell commented Oct 30, 2023

@charmander got it now. Yes the case is in postgres I have a column named default_value and I do

SELECT default_value->'data' AS default_value

Tried to rename alias and it works the same way as in 8.11.1

@charmander
Copy link
Collaborator

Duplicate of #3062

@charmander charmander marked this as a duplicate of #3062 Oct 30, 2023
@charmander charmander closed this as not planned Won't fix, can't repro, duplicate, stale Oct 30, 2023
@charmander charmander added the bug label Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants