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 '['

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

            rucha174 Rucha Deodhar added a comment - - edited patch: https://github.com/MariaDB/server/tree/bb-MDEV-30689-json_schema

            rucha174, I don't see in the patch test case for:

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

            this case is different from:

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

            lstartseva Lena Startseva added a comment - rucha174 , I don't see in the patch test case for: SELECT JSON_SCHEMA_VALID(json_object(), repeat( '[' , 10000000)); this case is different from: SELECT JSON_SCHEMA_VALID(repeat( '[' , 100000), json_object());
            rucha174 Rucha Deodhar added a comment -

            lstartseva thanks for noticing ! Added.

            rucha174 Rucha Deodhar added a comment - lstartseva thanks for noticing ! Added.

            see comments to the patch.

            holyfoot Alexey Botchkov added a comment - see comments to the patch.

            ok to push.

            holyfoot Alexey Botchkov added a comment - ok to push.

            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.