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

JSON_SCHEMA_VALID returns incorrect result for type=number

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Duplicate
    • N/A
    • 11.1.1
    • JSON
    • None

    Description

      For the schema with type=number all objects starts with number or minus is validated as correct:
      Test:

      SET @schema= '{"type":"number"}';
       
      SELECT JSON_SCHEMA_VALID(@schema, '3.14');
      SELECT JSON_SCHEMA_VALID(@schema, '0zzzz');
      SELECT JSON_SCHEMA_VALID(@schema, '-#');
      

      Expected result:

      JSON_SCHEMA_VALID(@schema, '3.14')
      1
       
      JSON_SCHEMA_VALID(@schema, '0zzzz')
      0
       
      SELECT JSON_SCHEMA_VALID(@schema, '-#')
      0
      

      It may be also necessary to generate a warning like here:

      SELECT JSON_SCHEMA_VALID(@schema, '.0');
      JSON_SCHEMA_VALID(@schema, '.0')
      0
      Warnings:
      Warning	4038	Syntax error in JSON text in argument 3 to function 'json_schema_valid' at position 1
      

      Actual result:

      JSON_SCHEMA_VALID(@schema, '3.14')
      1
       
      JSON_SCHEMA_VALID(@schema, '0zzzz')
      1
       
      SELECT JSON_SCHEMA_VALID(@schema, '-#')
      1
      

      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.