Bug 2169410

Summary: [MariaDB 10.3] JSON_VALUE() does not parse NULL properties properly
Product: Red Hat Enterprise Linux 8 Reporter: Paulo Andrade <pandrade>
Component: mariadbAssignee: Anton Bobrov <abobrov>
Status: VERIFIED --- QA Contact: Jakub Heger <jheger>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 8.7CC: abobrov, databases-maint, drehak, hhorak, ljavorsk
Target Milestone: rcKeywords: Rebase, Triaged, ZStream
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2223962 (view as bug list) Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2217001    
Bug Blocks: 2223962    

Description Paulo Andrade 2023-02-13 14:37:16 UTC
Issue reported upstream report at https://jira.mariadb.org/browse/MDEV-27151
also happens in rhel8.x mariadb.

User would like this issue patched.

Problem can be worked around, bug it is preferably to have it corrected in
the rhel package.

Comment 1 Michal Schorm 2023-05-15 09:52:49 UTC
Fixed by upstream in:
  https://github.com/MariaDB/server/commit/d48428e99aa7435ff72e2df7da05f35363e90ec3

The first upstream releases containing this fix should be:
  mariadb-10.5.18
  mariadb-10.3.37

Comment 4 Dominik Rehák 2023-08-09 05:54:56 UTC
Verified on 10.3.39 (expected output from reproducer matches).

mariadb-3:10.3.35-1.module+el8.6.0+15949+4ba4ec26:
 NULL
 NULL
 JSON_VALUE('{"nulltest": null}', '$.nulltest')
 null
 1 + NULL
 NULL
 1 + JSON_VALUE('{"nulltest": null}', '$.nulltest')
 1
 NULL
 NULL
 JSON_EXTRACT('{"a":null, "b":10, "c":"null"}', '$.a')
 null

mariadb-3:10.3.39-1.module+el8.8.0+19444+aac3c36b:
 NULL
 NULL
 JSON_VALUE('{"nulltest": null}', '$.nulltest')
 NULL
 1 + NULL
 NULL
 1 + JSON_VALUE('{"nulltest": null}', '$.nulltest')
 NULL
 NULL
 NULL
 JSON_EXTRACT('{"a":null, "b":10, "c":"null"}', '$.a')
 null