Skip to content

[Compatibility]: JSON_VALUE lacks MySQL RETURNING, ON EMPTY, and ON ERROR clauses #28037

Open

Description

@Ariznawlll

Description

MatrixOne implements only two-argument JSON_VALUE(json_doc, path) and rejects MySQL RETURNING, ON EMPTY, and ON ERROR syntax.

Environment

  • Branch: main
  • Commit: 17c161a31b47a22e71ca222839143f66717ac365
  • Deployment: local single-node MatrixOne
  • Test date: 2026-09-03

Steps to reproduce

SELECT JSON_VALUE('{"a":"3"}', '$.a' RETURNING UNSIGNED);\nSELECT JSON_VALUE('{"a":1}', '$.b' DEFAULT 7 ON EMPTY);\nSELECT JSON_VALUE('{"a":"x"}', '$.a' RETURNING UNSIGNED DEFAULT 0 ON ERROR);\n```\n\n## Actual behavior\n\nEach statement is rejected at the optional MySQL clause.\n\n## Expected behavior\n\nMySQL 8.0.21+ supports typed `RETURNING` conversion and explicit `ON EMPTY`/`ON ERROR` outcome control.\n\n## Stability and controls\n\n- Reproducer: `RETURNING` and `DEFAULT ... ON EMPTY` were rejected identically in 3/3 rounds; `ON ERROR` follows the same absent grammar branch.\n- Control: `JSON_VALUE('{"a":"3"}', '$.a')` returned `3` on the same service.\n- Failure atomicity: all reproducers are read-only expressions.\n\n## Evidence\n\nhttps://dev.mysql.com/doc/refman/8.0/en/json-search-functions.html\n\n## Code analysis\n\nThe registry has only two `JSON_VALUE` overloads, both returning `VARCHAR`; the MySQL grammar has no optional-clause production.\n\n## Regression coverage\n\nAfter implementation, add BVT cases for each RETURNING type, missing path, conversion failure, object/array result, defaults, errors, `NULL`, and clause order.

Activity

  1. added
    kind/bug
    on Sep 3, 2026
  2. added this to the MO-202609 milestone on Sep 3, 2026
  3. added theissue type on Sep 3, 2026
  4. added
    severity/s1
    and removed on Sep 6, 2026
  5. XuPeng-SH commented on Oct 22, 2026

    @XuPeng-SH
    Contributor

    QA checkpoint for PR #28275, current head 5d01c55cbbcec968c063e805667da6d5cdcfc5f1, base 060cb430e9ff59e60dc7bdade05758d343516acb (2026-10-22).

    The latest PR comment #6353053625 reports the scoped actual-stream admission/conflict repair, 13 owning-package terminals, three SQL consumers, vet/lint, and canonical BVT comparisons. These are author-reported results; I did not independently rerun them. This workspace has no MatrixOne checkout/service harness available.

    Current-head GitHub evidence: the commit status endpoint reports zero status checks (pending). The only workflow runs returned for this SHA are Connector/J Pool Reset E2E (in progress) and Iceberg Connector E2E (success); neither verifies JSON_VALUE. The latest submitted formal review remains CHANGES_REQUESTED on older head 6486d2f7abf18fef028f62052b518106536f4aff; no re-review of 5d01c55... is present.

    Still unresolved:

    • Legacy two-argument JSON_VALUE small-path lookups still perform full-document validation. The 17.818x figure is historical and has not been remeasured on this head; safe validation ownership or explicit cost acceptance is pending.
    • Independent approval of immutable design revision 9/final protocol allocation and deployed acceptance are pending.

    No new defect is asserted from this comment event. Issue #28037 remains OPEN and its existing assignee is unchanged; no transfer is warranted while acceptance gates remain open.

  6. XuPeng-SH commented on Nov 12, 2026

    @XuPeng-SH
    Contributor

    Merged-fix checkpoint (2026-11-12): #32546 is now merged into main at ff19bdc3c4430e8d50ad52dc1c4533f889803e4d. Its scope is immutable validated JSON read ownership and publication, a prerequisite for #28275; it explicitly does not add the missing JSON_VALUE RETURNING / ON EMPTY / ON ERROR SQL feature. #28275 remains open and unmerged at this check.

    Accordingly, #28037 remains with development rather than being handed to QA as a completed fix. The older checkpoint's foundation-design status is not being carried forward as a permanent blocker; the concrete remaining blocker is the unmerged SQL feature. PR #32546 records author-run package/race/BVT evidence and a retained, unclassified historical native failure; I did not run local tests in this check and do not assert that historical failure reproduces on the merged revision. No issue acceptance or deployed validation is claimed.

  7. Ariznawlll commented on Nov 13, 2026

    @Ariznawlll
    CollaboratorAuthor

    Corroborating data from the official mysql-test JSON suite (MO main a626dd045a, 2026-11-13): replaying the official suite/json/t/json_value.test (1220 lines) against current main yields 78 statement-level failures, every single one carrying the RETURNING <type> clause (CHAR/DECIMAL/BINARY/FLOAT/DOUBLE/SIGNED/UNSIGNED/DATETIME) or the ON EMPTY/ON ERROR clauses — a clean single-root-cause signature confirming this report's scope: the JSON_VALUE core path works (SELECT JSON_VALUE('...','$.data') → 'asdf' correct), only the typed-return grammar family is missing.

    The full 78-statement footprint with per-clause breakdown is available from the official-engine replay if useful for fix verification; the official .result also pins the RETURNING metadata columns (Type/Length/Flags in the mysqltest column header) that a fix will need to reproduce.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugseverity/s1

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions