Skip to content

MySQL JSON APIs are unavailable or reject valid calls #28033

Open

Description

@Ariznawlll

Description

Four MySQL JSON APIs are absent on MatrixOne main: JSON_ARRAY_INSERT, JSON_DEPTH, JSON_SEARCH, and the deprecated-but-supported JSON_MERGE alias.

Environment

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

Steps to reproduce

SELECT JSON_ARRAY_INSERT('[1,3]', '$[1]', 2);\nSELECT JSON_DEPTH('{"a":[1]}');\nSELECT JSON_SEARCH('{"a":"x"}', 'one', 'x');\nSELECT JSON_MERGE('{"a":1}', '{"a":2}');\n```\n\n## Actual behavior\n\nEach statement fails with `ERROR 20105: not supported: function or operator ...`.\n\n## Expected behavior\n\nMySQL 8.0 documents all four APIs. `JSON_MERGE` is deprecated in favor of `JSON_MERGE_PRESERVE`, but remains a supported compatibility alias.\n\n## Stability and controls\n\n- Reproducer: each statement failed identically in 3/3 rounds.\n- Controls: `JSON_ARRAY_APPEND`, `JSON_LENGTH`, `JSON_CONTAINS`, and `JSON_MERGE_PRESERVE` returned expected results 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-function-reference.html\n\n## Code analysis\n\n`pkg/sql/plan/function/function_id.go` has no registrations for these four names.\n\n## Regression coverage\n\nAfter implementation, add deterministic BVT cases for normal results, `NULL`, malformed JSON/path errors, and the `JSON_MERGE` alias equivalence.

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. VioletQwQ-0 commented on Sep 4, 2026

    @VioletQwQ-0
    Collaborator

    已完成源码级 triage。

    分析基线:upstream/main@a6f3988587bdba967a75015a0a12f9bf3a2c9bac。

    实施与合入顺序:

    1. JSON_MERGE:复用 JSON_MERGE_PRESERVE,补 MySQL 1287 deprecated warning。
    2. JSON_DEPTH:补严格输入类型和 ByteJSON 深度遍历。
    3. JSON_ARRAY_INSERT:补专用数组插入操作,并使用统一 JSON constructor conversion。
    4. JSON_SEARCH:补携带真实 location 的字符串遍历、LIKE/escape、path filter 和去重。

    依赖门槛:

    验证要求:

    • 每个 PR 均提供 Base FAIL / exact PR-head PASS、focused UT 和 canonical BVT 证据。
    • BVT 覆盖正常结果、NULL、非法 JSON/path/type 和边界行为;JSON_MERGE 额外验证 1287 warning,JSON_SEARCH 额外验证 prepared escape 和精确返回 path。
    • QA required: yes。以 MySQL 8.0.45 为 oracle;全部 PR 合并后再转测试,收到包含版本和环境的明确 PASS/FAIL 后决定关闭。
  5. added
    severity/s1
    and removed on Sep 4, 2026
  6. added a commit that references this issue on Oct 8, 2026
  7. added
    severity/s1
    and removed
    severity/s1
    on Oct 11, 2026
  8. changed the title [-][Compatibility]: MySQL JSON_ARRAY_INSERT, JSON_DEPTH, JSON_SEARCH, and JSON_MERGE are unavailable[/-] [+]MySQL JSON APIs are unavailable or reject valid calls[/+] on Oct 23, 2026
  9. XuPeng-SH commented on Oct 23, 2026

    @XuPeng-SH
    Contributor

    Scope consolidation from #30471: this issue now covers the overlapping missing MySQL JSON APIs plus two additional gaps from the compatibility scan. The original missing APIs remain JSON_ARRAY_INSERT, JSON_DEPTH, JSON_SEARCH and JSON_MERGE; add JSON_ARRAY_APPEND (missing) and JSON_OBJECTAGG (recognized but rejects a valid key/value call). Keep each function's behavior and error/NULL contract as an independent acceptance case; this is a shared compatibility tracking scope, not a claim of one implementation root.

    Additional repros from #30471:

    select json_array_append('[]', '$', 1); -- MySQL: [1]
    select json_objectagg(1, 2);            -- MySQL: {"1": 2}

    After implementation, validate each function independently with normal results, SQL NULL, malformed JSON/path inputs where applicable, argument validation, and prepared/CTAS forms where supported. The existing replacement-function controls and JSON_MERGE alias equivalence remain in scope.

  10. Ariznawlll commented on Oct 29, 2026

    @Ariznawlll
    CollaboratorAuthor

    Partial progress check on main c6683bd2f5 (2026-10-29, dual-CN local build), running the exact reproduction list from this issue:

    API status on current main
    JSON_ARRAY([1,2]) families working
    JSON_DEPTH('{"a":[1]}') working now — returns correct depth (verified JSON_DEPTH on {"a":1,"b":{"c":[true,null]}} → 4)
    JSON_SEARCH('{"a":"x"}','one','x') still missing — ERROR 20105: not supported: function or operator 'json_search'
    JSON_MERGE / alias not re-verified this round
    JSON_ARRAY_INSERT not re-verified this round (not tested)

    So at least JSON_DEPTH landed since this report was filed; JSON_SEARCH remains the outstanding gap from the original list (any app doing content search inside JSON columns still has no path). If the team prefers, splitting the remaining items into a checklist or closing the fixed entries would make the residual work clearer.

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