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

JSON_EXTRACT comparisons on cp1251 JSON falsely return ER_OUTOFMEMORY

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Duplicate
    • 12.3.3
    • N/A
    • JSON
    • None
    • MariaDB 12.3.3 binary distribution on Linux x86_64
    • Not for Release Notes

    Description

      Comparing a JSON string converted from cp1251 with utf8mb4 literals fails with ER_OUTOFMEMORY, although JSON_UNQUOTE decodes the same value successfully.

      This occurs when a JSON_EXTRACT result from a cp1251 JSON string is compared with utf8mb4 text.

      Run the control first:

      SET NAMES utf8mb4;
      SELECT JSON_UNQUOTE(CONVERT('"Ф"' USING cp1251)) = 'Ф' AS control_eq;

      It returns:

      control_eq
      1

      Then run each of these statements separately:

      SET NAMES utf8mb4;
      SELECT JSON_EXTRACT(CONVERT('"Ф"' USING cp1251), '$') = 'Ф' AS candidate_eq;

      SET NAMES utf8mb4;
      SELECT JSON_EXTRACT(CONVERT('"Ф"' USING cp1251), '$') <=> 'Ф' AS candidate_null_safe_eq;

      SET NAMES utf8mb4;
      SELECT JSON_EXTRACT(CONVERT('"Ф"' USING cp1251), '$') < 'Х' AS candidate_lt;

      Each comparison produces the same error:

      ERROR 1037 (HY001): Out of memory; restart server and try again (needed 1 bytes)

      The cp1251 JSON character Ф is decoded successfully by the control. The ordinary equality and null-safe equality comparisons should therefore return 1, and the ordering comparison Ф < Х should also return 1, without an allocation error.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Wren Qin
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.