[MDEV-25379] JSON_TABLE: ERROR ON clauses are ignored if a column is not on select list Created: 2021-04-09 Updated: 2021-04-21 Resolved: 2021-04-14 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | JSON |
| Affects Version/s: | N/A |
| Fix Version/s: | 10.6.0 |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Elena Stepanova | Assignee: | Alexey Botchkov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
This query returns an error as it is supposed to, because of ERROR ON EMPTY clause for column a:
However, if don't select the column a, it works:
Same applies for ERROR ON ERROR clauses. It is not quite clear from the standard what the expected behavior is. It only says that the clauses have the same semantics as for JSON_VALUE, but for JSON_VALUE the situation when the value is not selected is not applicable. Still, from the common sense alone, it just doesn't look right:
MySQL 8.0.23 returns an error for all queries above:
|
| Comments |
| Comment by Alexey Botchkov [ 2021-04-13 ] |
|
fixing patch https://github.com/MariaDB/server/commit/cea5e01ee5feffbcf2a7446241a69cef58ee8e9f |
| Comment by Sergei Petrunia [ 2021-04-13 ] |
|
Updated patch by Alexey: https://github.com/MariaDB/server/commit/e1dfe60e8024e2bfa07e735b17cff69cec0b5be7 |
| Comment by Sergei Petrunia [ 2021-04-13 ] |
|
Review: Is there anything that prevents from just unpacking into table->record[0]? The patch should also add a comment that ha_json_table::fill_column_values() |
| Comment by Alexey Botchkov [ 2021-04-14 ] |
|
newer patch |
| Comment by Sergei Petrunia [ 2021-04-14 ] |
|
Ok to push the latest |