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

Use JSON_VALUE() for scalar JSON values if available or workaround weird JSON_EXTRACT() behavior in regards to null otherwise #1899

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

lauxjpn
Copy link
Collaborator

@lauxjpn lauxjpn commented Mar 21, 2024

We will use JSON_VALUE() for scalar JSON values from now on, because it seems to handle null values correctly.

JSON_EXTRACT() will return a string with the contents of null for a JSON null value instead of a SQL NULL value (see Bug #85755: JSON containing null value is extracted as a string "null").

So when we have to depend on JSON_EXTRACT(), we have to explicitly check for that specific case to ensure that the expected value is returned.

Fixes #1897

@lauxjpn lauxjpn added type-bug backport-candidate Should be considered for backporting. labels Mar 21, 2024
@lauxjpn lauxjpn added this to the 9.0.0-preview.2 milestone Mar 21, 2024
@lauxjpn lauxjpn self-assigned this Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-candidate Should be considered for backporting. type-bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace JSON_EXTRACT utilisation with JSON_VALUE
1 participant