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

JSON_TABLE: bad error reporting for invalid json

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.6.0
    • 10.6
    • JSON
    • None

    Description

      Let's make an intentional mistake and feed JSON_TABLE an invalid JSON:

      MariaDB [test]> set @json='
          '> [
          '>   {"name":"Laptop", "color":"black", price:null},
          '>   {"name":"Jeans",  "color":"blue", price:""}
          '> ]';
      Query OK, 0 rows affected (0.000 sec)
      

      Then let's try reading

      MariaDB [test]> select * from json_table(@json, '$[*]' 
          ->   columns(
          ->    name  varchar(10) path '$.name', 
          ->    color varchar(10) path '$.color',
          ->    price varchar(10) path '$.price' error on empty ) 
          -> ) as jt;
      ERROR 4176 (HY000): Field 'price' can't be set for JSON_TABLE 'jt'.
      

      The error text doesn't indicate that the passed JSON was invalid.

      Attachments

        Activity

          People

            rucha174 Rucha Deodhar
            psergei Sergei Petrunia
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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