Conversation
… Silently Ignored
JSON_TABLE can return a converted zero for a nonnumeric JSON string even
when the column specifies NULL ON ERROR. For example, converting the
value in {"a":"str"} to an INT column should take the column's error
response and return NULL.
The scalar conversion helper discards Field::store()'s return value. A
shared Counting_error_handler also fails to represent conversion
warnings as a column-local conversion failure. As a result, the
provisional converted value can be returned without invoking the
column's ON ERROR response.
Return the scalar field-store status through an output argument. Use a
conversion-local error handler to capture warnings and errors while
leaving notes visible. Combine the store status and captured conversion
failure before invoking the existing ON ERROR responder. Scope the
JSON-format counting handler to its individual conversion so diagnostics
from one column do not become another column's conversion state.
The regression converts a nonnumeric JSON string to INT with NULL ON
ERROR and expects SQL NULL. The implementation uses the existing error
responder for NULL, DEFAULT, and ERROR policies; the regression directly
covers the NULL policy.
Bug report: https://jira.mariadb.org/browse/MDEV-40972
DerZc
force-pushed
the
fix-mdev-40972
branch
from
September 21, 2026 05:59
190c5c5 to
21761be
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JSON_TABLE can return a converted zero for a nonnumeric JSON string even when the column specifies NULL ON ERROR. For example, converting the value in {"a":"str"} to an INT column should take the column's error response and return NULL.
Bug report: https://jira.mariadb.org/browse/MDEV-40972
Root cause
The scalar conversion helper discards Field::store()'s return value. A shared Counting_error_handler also fails to represent conversion warnings as a column-local conversion failure. As a result, the provisional converted value can be returned without invoking the column's ON ERROR response.
Changes
Regression coverage
The regression converts a nonnumeric JSON string to INT with NULL ON ERROR and expects SQL NULL. The implementation uses the existing error responder for NULL, DEFAULT, and ERROR policies; the regression directly covers the NULL policy.
mysql-test/main/json_table_null_on_error.resultmysql-test/main/json_table_null_on_error.testValidation
On
11.4atd10e5d726799b1cd57cc866f40aad68c720803da:main.json_table_null_on_errorfailed on the unchanged target branch and passed with this fix.main.func_json,main.select,main.type_decimal,main.type_float.