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

JSON_SCHEMA_VALID for type=array return 1 for any string that starts with '['

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • 11.1.1
    • JSON
    • None

    Description

      Case:

      SET @schema_array= '{"type":"array"}';
      SELECT JSON_SCHEMA_VALID(@schema_array, '[');
      

      In case it is missed closing brace for array, but result is still 1:

      JSON_SCHEMA_VALID(json_object(),'[[')
      1
      

      Expected result:

      JSON_SCHEMA_VALID(json_object(),'[[')
      0
      

      Or maybe result+warning

      The same problem presents for case:

      SELECT JSON_SCHEMA_VALID(repeat('[', 100000), json_object());
      

      Actual result:

      SELECT JSON_SCHEMA_VALID(repeat('[', 100000), json_object());
      JSON_SCHEMA_VALID(repeat('[', 100000), json_object())
      1
      Warnings:
      Warning	4040	Limit of 32 on JSON nested structures depth is reached in argument 2 to function 'json_schema_valid' at position 32
      

      Expected result (result must be NULL):

      SELECT JSON_SCHEMA_VALID(repeat('[', 100000), json_object());
      JSON_SCHEMA_VALID(repeat('[', 100000), json_object())
      NULL
      Warnings:
      Warning	4040	Limit of 32 on JSON nested structures depth is reached in argument 2 to function 'json_schema_valid' at position 32
      

      Also after fix bug the following case should also be tested:

      SELECT JSON_SCHEMA_VALID(json_object(), repeat('[', 10000000));
      

      Attachments

        Issue Links

          Activity

            People

              rucha174 Rucha Deodhar
              lstartseva Lena Startseva
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.