[Maria-developers] MDEV-17399: Columns of JSON datatype?

2021-02-04 Thread Sergey Petrunia
Hi Alexey, Consider this: select * from json_table( '{"a":[1,2]}', '$' columns ( jsn_path json path '$.a' default '{}' on empty ) ) as tt; MySQL produces: +--+ | jsn_path | +--+ | [1, 2] | +--+ MariaDB produces: +--+ | jsn_path | +--+ | NUL

[Maria-developers] MDEV-17399: DEFAULT clause values are not JSON (and this is ok)

2021-02-04 Thread Sergey Petrunia
== Short == I've discovered another mismatch between MariaDB implementation and MySQL. I don't think we need to fix it. == Long == select * from json_table( '[{"a":"aa"}, {"b":"bb"}]', '$[*]' columns ( col1 varchar(100) path '$.b' default 'bbb' on empty ) ) as tt; In MySQL, this gi

[Maria-developers] MDEV-17399: JSON null is not converted to SQL NULL?

2021-02-04 Thread Sergey Petrunia
== Short == JSON null value should be converted to SQL NULL value, but it is converted to 0 or "null" instead: == Long == select * from json_table( '[{"a":"aa"}, {"b":null}]', '$[*]' columns ( col1 int path '$.b' default '456' on empty ) ) as tt; MariaDB: +--+ | col1 | +--+

[Maria-developers] MDEV-17399: ON ERROR clause doesn't work for datatype conversion errors?

2021-02-04 Thread Sergey Petrunia
Hi Alexey, Consider this: select * from json_table( '[{"a":"asd"}, {"a":123}, {"a":[]}, {"a":{}} ]', '$[*]' columns ( id for ordinality, intcol int path '$.a' default '1234' on empty default '5678' on error ) ) as tt; +--++ | id | intcol | +--+-