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

JSON_TABLE: Non-descriptive ER_PARSE_ERROR error upon a missing alias

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • N/A
    • 10.6.0
    • JSON, Parser
    • None

    Description

      Upon a missing mandatory JSON table alias, MariaDB produces the generic syntax error ER_PARSE_ERROR:

      bb-10.6-mdev17399-psergey2 8b533cc1d5

      MariaDB [db]> select * from json_table('[]', '$' COLUMNS(x FOR ORDINALITY));
      ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
      

      while MySQL returns a nicer context-specific error:

      MySQL 8.0.23

      MySQL [db]> select * from json_table('[]', '$' COLUMNS(x FOR ORDINALITY));
      ERROR 3667 (42000): Every table function must have an alias
      

      It is a cosmetic problem, but deep within a more complicated query it can become confusing.

      Attachments

        Issue Links

          Activity

            People

              holyfoot Alexey Botchkov
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.