← Back to team overview

maria-developers team mailing list archive

MDEV-17399: JSON null is not converted to SQL NULL?

 

== 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 |
+------+
|  456 |
|    0 |
+------+

MySQL and OracleDB:
+------+
| col1 |
+------+
| 456  |
| NULL |
+------+

If I change "col1 int" into "col1 varchar(100)", I get a string with "null". 
I think this is incorrect and should be fixed.

AFAIU, SQL Standard describes it here: see my previous email, then look at
section 9.40, 4.b.ii:

ii) If I is the SQL/JSON null, then let V be the SQL null value.

BR
 Sergei
-- 
Sergei Petrunia, Software Developer
MariaDB Corporation | Skype: sergefp | Blog: http://petrunia.net




References