Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-30634

JSON_INSERT does not return NULL

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Trivial
    • Resolution: Fixed
    • 10.10.3
    • N/A
    • Documentation, JSON
    • None

    Description

      According to the docs here: https://mariadb.com/kb/en/json_insert/

      > Inserts data into a JSON document, returning the resulting document or NULL if any argument is null.

      However:

      I'm assuming the docs are just worded incorrectly.

      Passing 3 arguments of which the 2nd is NULL returns NULL, while consistent with docs this feels weird since other incorrect path strings generate errors

      Proposal 1:
      Fix docs to say "Inserts data into a JSON document, returning the resulting document or NULL if the json_doc or any path is null.

      Proposal 2:
      Fix JSON_INSERT and family to never return NULL on invalid arguments. The returning of NULL in cases of bad paths can lead to destructive writes and forces every developer to check these cases.

      Attachments

        Activity

          People

            greenman Ian Gilfillan
            sammousa Sam Mousa
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.