[MDEV-25822] JSON_TABLE: default values should allow non-string literals Created: 2021-05-30 Updated: 2023-11-06 |
|
| Status: | In Review |
| Project: | MariaDB Server |
| Component/s: | JSON |
| Affects Version/s: | 10.6 |
| Fix Version/s: | 10.6 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Sergei Petrunia | Assignee: | Sergei Petrunia |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Filing this for https://www.mail-archive.com/maria-developers@lists.launchpad.net/msg12296.html At the moment MariaDB requires that the values in DEFAULT clauses are quoted.
here, "100" must be quoted, otherwise one gets a parse error. However, the quoted value is interpreted as an SQL literal. This looks puzzling. MySQL-8 also requires that the default value is quoted, but they have a (very odd) reason for it: they interpret the default value as JSON: https://docs.oracle.com/cd/E17952_01/mysql-8.0-en/json-table-functions.html
I am not sure why MySQL chose to do this. Looking into the SQL Standard, one
This doesn't say whether the <value expression> should be interepreted as JSON
The important part is:
which means it is not JSON. It is just a literal, and literal can be a string Btw, Oracle Database allows non-string literals in the default clause: |
| Comments |
| Comment by Sergei Petrunia [ 2021-05-30 ] |
|
A patch by Alexey: https://github.com/MariaDB/server/commit/9c518e4cc9b0569cae2daa5a4024e209293eca45 |
| Comment by Sergei Petrunia [ 2021-06-08 ] |
|
Review input: https://lists.launchpad.net/maria-developers/msg12763.html |
| Comment by Alexey Botchkov [ 2021-06-16 ] |
|
https://github.com/MariaDB/server/commit/8dae7ee02f98e71e9352d73d1da235fd4128d076 |