← Back to team overview

maria-developers team mailing list archive

Re: 734aee3cd3c: MDEV-27018 IF and COALESCE lose "json" property


Hello Sergei,

Please find a new patch version here:


On 1/3/22 5:26 PM, Sergei Golubchik wrote:
Hi, Alexander!

- We'll probably have more FORMATs in the future.

Like what? As far as I can see, standard doesn't support FORMAT in the
column definition at all.

There will be no new formats in the near future probably,
unless the next standard introduces it :)

Still, even if we have only JSON, my point here was that it's not
a good idea to have JSON specific tests per row inside
Field_string/varstring/blob for non-JSON "normal"

So JSON deserves its own Field_string_json, Field_varstring_json
and Field_blob_json. I want to add them later. But not in this patch.


I'd expect it to find VARCHAR/JSON+TEXT/JSON right away.
It would've naturally preserved the json property.

Otherwise you'd need to do an extra json propagation.

Here, of course, I mean not Item_func_plus, but, say, COALESCE. Or UNION.

Fixed according to our slack discussion.

Type_collection_json::aggregate_json_for_result() now
performs aggregation of two JSON types by aggregating
their base types and then converting a general purpose
string type to the corresponding JSON type.

diff --git a/sql/sql_type_json.cc b/sql/sql_type_json.cc
index a804366ec03..a84f720bcc9 100644
--- a/sql/sql_type_json.cc
+++ b/sql/sql_type_json.cc
@@ -20,17 +20,111 @@
   #include "sql_class.h"
-Type_handler_json_longtext type_handler_json_longtext;
+  type_handler_string_json("char/json");

do you mean these names are not shown anywhere?

They are shown in error messages, e.g.:

Illegal parameter data types inet6 and longblob/json for operation '+'

eh, okay. may be we should change it later
to "longblob format json". But not now.

VP of MariaDB Server Engineering
and security@xxxxxxxxxxx