[MDEV-25139] JSON_TABLE: Non-descriptive ER_PARSE_ERROR error upon a missing alias Created: 2021-03-15  Updated: 2021-03-19  Resolved: 2021-03-16

Status: Closed
Project: MariaDB Server
Component/s: JSON, Parser
Affects Version/s: N/A
Fix Version/s: 10.6.0

Type: Bug Priority: Minor
Reporter: Elena Stepanova Assignee: Alexey Botchkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-17399 Add support for JSON_TABLE Closed

 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.


Generated at Thu Feb 08 09:35:26 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.