← Back to team overview

maria-developers team mailing list archive

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

 

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 |
+------+--------+
|    1 |      0 |
|    2 |    123 |
|    3 |   5678 |
|    4 |   5678 |
+------+--------+

We can see that "default '5678' on error" clause took effect for the rows #3 and
#4, but not for row #1.  Also, no conversion warning was issued.

MySQL and OracleDB produce this row, instead:
+------+--------+
| id   | intcol |
+------+--------+
|    1 |   5678 |

I think MariaDB should do that, too. (and if not, we need to provide a
reasoning why).  What do you think?

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




References