From 832fb0d6558b053b3717cff37429166b36d2d9b3 Mon Sep 17 00:00:00 2001 From: Hadeer Ramadan Date: Tue, 16 Jun 2026 14:19:01 +0000 Subject: [PATCH 1/4] MDEV-38740: Implement a distinct data type for JSON Starting by intailizeing and loading json type plugin Put basic definition of Field_json --- plugin/type_json/CMakeLists.txt | 3 ++ .../type_json/mysql-test/type_json/suite.pm | 0 .../mysql-test/type_json/type_json.result | 0 .../mysql-test/type_json/type_json.test | 0 plugin/type_json/plugin.cc | 31 +++++++++++++ plugin/type_json/sql_type_json.cc | 7 +++ plugin/type_json/sql_type_json.h | 44 +++++++++++++++++++ 7 files changed, 85 insertions(+) create mode 100644 plugin/type_json/CMakeLists.txt create mode 100644 plugin/type_json/mysql-test/type_json/suite.pm create mode 100644 plugin/type_json/mysql-test/type_json/type_json.result create mode 100644 plugin/type_json/mysql-test/type_json/type_json.test create mode 100644 plugin/type_json/plugin.cc create mode 100644 plugin/type_json/sql_type_json.cc create mode 100644 plugin/type_json/sql_type_json.h diff --git a/plugin/type_json/CMakeLists.txt b/plugin/type_json/CMakeLists.txt new file mode 100644 index 0000000000000..d10311a49ff69 --- /dev/null +++ b/plugin/type_json/CMakeLists.txt @@ -0,0 +1,3 @@ +MYSQL_ADD_PLUGIN(type_json + plugin.cc sql_type_json.cc + MANDATORY RECOMPILE_FOR_EMBEDDED) diff --git a/plugin/type_json/mysql-test/type_json/suite.pm b/plugin/type_json/mysql-test/type_json/suite.pm new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/plugin/type_json/mysql-test/type_json/type_json.result b/plugin/type_json/mysql-test/type_json/type_json.result new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/plugin/type_json/mysql-test/type_json/type_json.test b/plugin/type_json/mysql-test/type_json/type_json.test new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/plugin/type_json/plugin.cc b/plugin/type_json/plugin.cc new file mode 100644 index 0000000000000..7b0294548b638 --- /dev/null +++ b/plugin/type_json/plugin.cc @@ -0,0 +1,31 @@ +#define MYSQL_SERVER +#include "mariadb.h" +#include "sql_class.h" +#include "sql_type_json.h" +#include +#include + +static struct st_mariadb_data_type plugin_descriptor_json= +{ + MariaDB_DATA_TYPE_INTERFACE_VERSION, + &type_handler_json +}; + +maria_declare_plugin(type_json) +{ + MariaDB_DATA_TYPE_PLUGIN, // the plugin type (see include/mysql/plugin.h) + &plugin_descriptor_json, // pointer to type-specific plugin descriptor + "json", // plugin name + "MariaDB Corporation", // plugin author + "Data type json", // the plugin description + PLUGIN_LICENSE_GPL, // the plugin license (see include/mysql/plugin.h) + 0, // Pointer to plugin initialization function + 0, // Pointer to plugin deinitialization function + 0x0100, // Numeric version 0xAABB means AA.BB version + NULL, // Status variables + NULL, // System variables + "1.0", // String version representation + MariaDB_PLUGIN_MATURITY_GAMMA // Maturity(see include/mysql/plugin.h)*/ +} +maria_declare_plugin_end; + diff --git a/plugin/type_json/sql_type_json.cc b/plugin/type_json/sql_type_json.cc new file mode 100644 index 0000000000000..8d58efbbe9f1d --- /dev/null +++ b/plugin/type_json/sql_type_json.cc @@ -0,0 +1,7 @@ +#define MYSQL_SERVER +#include "mariadb.h" +#include "sql_type_json.h" + + + +Type_handler_json type_handler_json; \ No newline at end of file diff --git a/plugin/type_json/sql_type_json.h b/plugin/type_json/sql_type_json.h new file mode 100644 index 0000000000000..0a4b53c04c75f --- /dev/null +++ b/plugin/type_json/sql_type_json.h @@ -0,0 +1,44 @@ +#ifndef SQL_TYPE_JSON_PLUGIN_INCLUDED +#define SQL_TYPE_JSON_PLUGIN_INCLUDED + + +#include "mariadb.h" +#include "sql_type.h" + +class Type_handler_json: public Type_handler_long_blob{ + + + + + +}; + +extern Type_handler_json type_handler_json; + +#include "field.h" + +class Field_json:public Field_blob +{ + +public: + Field_json(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, + enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg, + TABLE_SHARE *share, uint blob_pack_length, + const DTCollation &collation) + : Field_blob(ptr_arg, null_ptr_arg, null_bit_arg, unireg_check_arg, + field_name_arg, share, blob_pack_length, collation) + {} + const Type_handler *type_handler() const override + { + return &type_handler_json; + } + + void sql_type(String $str) const override; + + uint size_of() const override { + return sizeof(*this); + } + +}; + +#endif // SQL_TYPE_JSON_INCLUDED From a42849c066c1b6b2ee2de2c52aa23b64745708c2 Mon Sep 17 00:00:00 2001 From: Hadeer Ramadan Date: Sat, 20 Jun 2026 13:54:25 +0000 Subject: [PATCH 2/4] MDEV-38740 Implement JSON as a pluggable data type - Implemented the JSON data type via 'MariaDB_DATA_TYPE_PLUGIN1 API - `SHOW CREATE TABLE` and `DESCRIBE` now explicitly display the column type as `json` instead of `longtext`. - Move json tests to the plugin and split it into smaller focused files inside the plugin test suite. - follow structure xmltype plugin --- mysql-test/main/type_json.test | 3 +- mysql-test/suite/json/r/type_json.result | 408 +++++++++--------- .../mysql-test/type_json/r/type_json.result | 172 ++++++++ .../type_json/r/type_json_basic.result | 53 +++ .../mysql-test/type_json/t/type_json.test | 169 ++++++++ .../type_json/t/type_json_basic.test | 29 ++ .../type_json_cast.test} | 0 .../type_json_protocol.test} | 0 .../type_json/t/type_json_validation.test | 40 ++ plugin/type_json/sql_type_json.cc | 105 ++++- plugin/type_json/sql_type_json.h | 96 ++++- sql/sql_yacc.yy | 5 +- 12 files changed, 852 insertions(+), 228 deletions(-) create mode 100644 plugin/type_json/mysql-test/type_json/r/type_json.result create mode 100644 plugin/type_json/mysql-test/type_json/r/type_json_basic.result create mode 100644 plugin/type_json/mysql-test/type_json/t/type_json.test create mode 100644 plugin/type_json/mysql-test/type_json/t/type_json_basic.test rename plugin/type_json/mysql-test/type_json/{type_json.result => t/type_json_cast.test} (100%) rename plugin/type_json/mysql-test/type_json/{type_json.test => t/type_json_protocol.test} (100%) create mode 100644 plugin/type_json/mysql-test/type_json/t/type_json_validation.test diff --git a/mysql-test/main/type_json.test b/mysql-test/main/type_json.test index 8effe78f803d4..73a5848709422 100644 --- a/mysql-test/main/type_json.test +++ b/mysql-test/main/type_json.test @@ -7,10 +7,11 @@ show create table t1; --error ER_PARSE_ERROR create or replace table t1(a json character set utf8); - +# create or replace table t1(a json default '{a:1}'); show create table t1; + create or replace table t1(a json not null check (json_valid(a))); show create table t1; insert t1 values ('[]'); diff --git a/mysql-test/suite/json/r/type_json.result b/mysql-test/suite/json/r/type_json.result index 48d11a608d7e2..4ec49aea12c7c 100644 --- a/mysql-test/suite/json/r/type_json.result +++ b/mysql-test/suite/json/r/type_json.result @@ -85,27 +85,27 @@ c12 ENUM('1','2') DEFAULT '1' INSERT INTO t2 VALUES (); CALL p1('t1', 'COALESCE(colt1, colt2)'); Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c0, c0) 254 (format=json) 30 1 Y 0 39 8 +def COALESCE(c0, c0) 254 30 1 Y 0 39 8 COALESCE(c0, c0) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c0, c1) 253 (format=json) 30 1 Y 0 39 8 +def COALESCE(c0, c1) 253 30 1 Y 0 39 8 COALESCE(c0, c1) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c0, c2) 252 (format=json) 1020 1 Y 0 39 8 +def COALESCE(c0, c2) 252 1020 1 Y 0 39 8 COALESCE(c0, c2) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c0, c3) 250 (format=json) 262140 1 Y 0 39 8 +def COALESCE(c0, c3) 250 262140 1 Y 0 39 8 COALESCE(c0, c3) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c0, c4) 251 (format=json) 67108860 1 Y 0 39 8 +def COALESCE(c0, c4) 251 67108860 1 Y 0 39 8 COALESCE(c0, c4) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c0, c5) 251 (format=json) 4294967292 1 Y 0 39 8 +def COALESCE(c0, c5) 251 4294967292 1 Y 0 39 8 COALESCE(c0, c5) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -113,31 +113,31 @@ def COALESCE(c0, c6) 254 30 1 Y 0 39 8 COALESCE(c0, c6) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c0, c7) 253 30 1 Y 0 39 8 +def COALESCE(c0, c7) 254 (format=json) 30 1 Y 0 39 8 COALESCE(c0, c7) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c1, c0) 253 (format=json) 30 1 Y 0 39 8 +def COALESCE(c1, c0) 253 30 1 Y 0 39 8 COALESCE(c1, c0) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c1, c1) 253 (format=json) 30 1 Y 0 39 8 +def COALESCE(c1, c1) 253 30 1 Y 0 39 8 COALESCE(c1, c1) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c1, c2) 252 (format=json) 1020 1 Y 0 39 8 +def COALESCE(c1, c2) 252 1020 1 Y 0 39 8 COALESCE(c1, c2) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c1, c3) 250 (format=json) 262140 1 Y 0 39 8 +def COALESCE(c1, c3) 250 262140 1 Y 0 39 8 COALESCE(c1, c3) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c1, c4) 251 (format=json) 67108860 1 Y 0 39 8 +def COALESCE(c1, c4) 251 67108860 1 Y 0 39 8 COALESCE(c1, c4) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c1, c5) 251 (format=json) 4294967292 1 Y 0 39 8 +def COALESCE(c1, c5) 251 4294967292 1 Y 0 39 8 COALESCE(c1, c5) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -145,31 +145,31 @@ def COALESCE(c1, c6) 253 30 1 Y 0 39 8 COALESCE(c1, c6) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c1, c7) 253 30 1 Y 0 39 8 +def COALESCE(c1, c7) 253 (format=json) 30 1 Y 0 39 8 COALESCE(c1, c7) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c2, c0) 252 (format=json) 1020 1 Y 0 39 8 +def COALESCE(c2, c0) 252 1020 1 Y 0 39 8 COALESCE(c2, c0) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c2, c1) 252 (format=json) 1020 1 Y 0 39 8 +def COALESCE(c2, c1) 252 1020 1 Y 0 39 8 COALESCE(c2, c1) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c2, c2) 252 (format=json) 1020 1 Y 0 39 8 +def COALESCE(c2, c2) 252 1020 1 Y 0 39 8 COALESCE(c2, c2) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c2, c3) 250 (format=json) 262140 1 Y 0 39 8 +def COALESCE(c2, c3) 250 262140 1 Y 0 39 8 COALESCE(c2, c3) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c2, c4) 251 (format=json) 67108860 1 Y 0 39 8 +def COALESCE(c2, c4) 251 67108860 1 Y 0 39 8 COALESCE(c2, c4) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c2, c5) 251 (format=json) 4294967292 1 Y 0 39 8 +def COALESCE(c2, c5) 251 4294967292 1 Y 0 39 8 COALESCE(c2, c5) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -177,31 +177,31 @@ def COALESCE(c2, c6) 252 1020 1 Y 0 39 8 COALESCE(c2, c6) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c2, c7) 252 1020 1 Y 0 39 8 +def COALESCE(c2, c7) 252 (format=json) 1020 1 Y 0 39 8 COALESCE(c2, c7) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c3, c0) 250 (format=json) 262140 1 Y 0 39 8 +def COALESCE(c3, c0) 250 262140 1 Y 0 39 8 COALESCE(c3, c0) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c3, c1) 250 (format=json) 262140 1 Y 0 39 8 +def COALESCE(c3, c1) 250 262140 1 Y 0 39 8 COALESCE(c3, c1) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c3, c2) 250 (format=json) 262140 1 Y 0 39 8 +def COALESCE(c3, c2) 250 262140 1 Y 0 39 8 COALESCE(c3, c2) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c3, c3) 250 (format=json) 262140 1 Y 0 39 8 +def COALESCE(c3, c3) 250 262140 1 Y 0 39 8 COALESCE(c3, c3) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c3, c4) 251 (format=json) 67108860 1 Y 0 39 8 +def COALESCE(c3, c4) 251 67108860 1 Y 0 39 8 COALESCE(c3, c4) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c3, c5) 251 (format=json) 4294967292 1 Y 0 39 8 +def COALESCE(c3, c5) 251 4294967292 1 Y 0 39 8 COALESCE(c3, c5) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -209,31 +209,31 @@ def COALESCE(c3, c6) 250 262140 1 Y 0 39 8 COALESCE(c3, c6) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c3, c7) 250 262140 1 Y 0 39 8 +def COALESCE(c3, c7) 250 (format=json) 262140 1 Y 0 39 8 COALESCE(c3, c7) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c4, c0) 251 (format=json) 67108860 1 Y 0 39 8 +def COALESCE(c4, c0) 251 67108860 1 Y 0 39 8 COALESCE(c4, c0) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c4, c1) 251 (format=json) 67108860 1 Y 0 39 8 +def COALESCE(c4, c1) 251 67108860 1 Y 0 39 8 COALESCE(c4, c1) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c4, c2) 251 (format=json) 67108860 1 Y 0 39 8 +def COALESCE(c4, c2) 251 67108860 1 Y 0 39 8 COALESCE(c4, c2) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c4, c3) 251 (format=json) 67108860 1 Y 0 39 8 +def COALESCE(c4, c3) 251 67108860 1 Y 0 39 8 COALESCE(c4, c3) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c4, c4) 251 (format=json) 67108860 1 Y 0 39 8 +def COALESCE(c4, c4) 251 67108860 1 Y 0 39 8 COALESCE(c4, c4) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c4, c5) 251 (format=json) 4294967292 1 Y 0 39 8 +def COALESCE(c4, c5) 251 4294967292 1 Y 0 39 8 COALESCE(c4, c5) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -241,31 +241,31 @@ def COALESCE(c4, c6) 251 67108860 1 Y 0 39 8 COALESCE(c4, c6) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c4, c7) 251 67108860 1 Y 0 39 8 +def COALESCE(c4, c7) 251 (format=json) 67108860 1 Y 0 39 8 COALESCE(c4, c7) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c5, c0) 251 (format=json) 4294967292 1 Y 0 39 8 +def COALESCE(c5, c0) 251 4294967292 1 Y 0 39 8 COALESCE(c5, c0) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c5, c1) 251 (format=json) 4294967292 1 Y 0 39 8 +def COALESCE(c5, c1) 251 4294967292 1 Y 0 39 8 COALESCE(c5, c1) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c5, c2) 251 (format=json) 4294967292 1 Y 0 39 8 +def COALESCE(c5, c2) 251 4294967292 1 Y 0 39 8 COALESCE(c5, c2) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c5, c3) 251 (format=json) 4294967292 1 Y 0 39 8 +def COALESCE(c5, c3) 251 4294967292 1 Y 0 39 8 COALESCE(c5, c3) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c5, c4) 251 (format=json) 4294967292 1 Y 0 39 8 +def COALESCE(c5, c4) 251 4294967292 1 Y 0 39 8 COALESCE(c5, c4) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c5, c5) 251 (format=json) 4294967292 1 Y 0 39 8 +def COALESCE(c5, c5) 251 4294967292 1 Y 0 39 8 COALESCE(c5, c5) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -273,7 +273,7 @@ def COALESCE(c5, c6) 251 4294967292 1 Y 0 39 8 COALESCE(c5, c6) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c5, c7) 251 4294967292 1 Y 0 39 8 +def COALESCE(c5, c7) 251 (format=json) 4294967292 1 Y 0 39 8 COALESCE(c5, c7) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -309,27 +309,27 @@ def COALESCE(c6, c7) 253 11 1 Y 0 39 8 COALESCE(c6, c7) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c7, c0) 253 30 1 Y 0 39 8 +def COALESCE(c7, c0) 254 (format=json) 30 1 Y 0 39 8 COALESCE(c7, c0) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c7, c1) 253 30 1 Y 0 39 8 +def COALESCE(c7, c1) 253 (format=json) 30 1 Y 0 39 8 COALESCE(c7, c1) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c7, c2) 252 1020 1 Y 0 39 8 +def COALESCE(c7, c2) 252 (format=json) 1020 1 Y 0 39 8 COALESCE(c7, c2) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c7, c3) 250 262140 1 Y 0 39 8 +def COALESCE(c7, c3) 250 (format=json) 262140 1 Y 0 39 8 COALESCE(c7, c3) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c7, c4) 251 67108860 1 Y 0 39 8 +def COALESCE(c7, c4) 251 (format=json) 67108860 1 Y 0 39 8 COALESCE(c7, c4) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c7, c5) 251 4294967292 1 Y 0 39 8 +def COALESCE(c7, c5) 251 (format=json) 4294967292 1 Y 0 39 8 COALESCE(c7, c5) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -370,7 +370,7 @@ def LEAST(c0, c6) 5 23 1 Y 32896 31 63 LEAST(c0, c6) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(c0, c7) 253 30 1 Y 0 39 8 +def LEAST(c0, c7) 254 (format=json) 30 1 Y 0 39 8 LEAST(c0, c7) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -402,7 +402,7 @@ def LEAST(c1, c6) 5 23 1 Y 32896 31 63 LEAST(c1, c6) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(c1, c7) 253 30 1 Y 0 39 8 +def LEAST(c1, c7) 253 (format=json) 30 1 Y 0 39 8 LEAST(c1, c7) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -434,7 +434,7 @@ def LEAST(c2, c6) 5 23 1 Y 32896 31 63 LEAST(c2, c6) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(c2, c7) 252 1020 1 Y 0 39 8 +def LEAST(c2, c7) 252 (format=json) 1020 1 Y 0 39 8 LEAST(c2, c7) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -466,7 +466,7 @@ def LEAST(c3, c6) 5 23 1 Y 32896 31 63 LEAST(c3, c6) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(c3, c7) 250 262140 1 Y 0 39 8 +def LEAST(c3, c7) 250 (format=json) 262140 1 Y 0 39 8 LEAST(c3, c7) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -498,7 +498,7 @@ def LEAST(c4, c6) 5 23 1 Y 32896 31 63 LEAST(c4, c6) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(c4, c7) 251 67108860 1 Y 0 39 8 +def LEAST(c4, c7) 251 (format=json) 67108860 1 Y 0 39 8 LEAST(c4, c7) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -530,7 +530,7 @@ def LEAST(c5, c6) 5 23 1 Y 32896 31 63 LEAST(c5, c6) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(c5, c7) 251 4294967292 1 Y 0 39 8 +def LEAST(c5, c7) 251 (format=json) 4294967292 1 Y 0 39 8 LEAST(c5, c7) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -566,27 +566,27 @@ def LEAST(c6, c7) 5 17 1 Y 32896 0 63 LEAST(c6, c7) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(c7, c0) 253 30 1 Y 0 39 8 +def LEAST(c7, c0) 254 (format=json) 30 1 Y 0 39 8 LEAST(c7, c0) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(c7, c1) 253 30 1 Y 0 39 8 +def LEAST(c7, c1) 253 (format=json) 30 1 Y 0 39 8 LEAST(c7, c1) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(c7, c2) 252 1020 1 Y 0 39 8 +def LEAST(c7, c2) 252 (format=json) 1020 1 Y 0 39 8 LEAST(c7, c2) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(c7, c3) 250 262140 1 Y 0 39 8 +def LEAST(c7, c3) 250 (format=json) 262140 1 Y 0 39 8 LEAST(c7, c3) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(c7, c4) 251 67108860 1 Y 0 39 8 +def LEAST(c7, c4) 251 (format=json) 67108860 1 Y 0 39 8 LEAST(c7, c4) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(c7, c5) 251 4294967292 1 Y 0 39 8 +def LEAST(c7, c5) 251 (format=json) 4294967292 1 Y 0 39 8 LEAST(c7, c5) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -856,27 +856,27 @@ c7+c7 2 CALL p1('t1c', 'COALESCE(colt1, colt2)'); Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c0, c0) 254 (format=json) 30 1 Y 0 39 8 +def COALESCE(c0, c0) 254 30 1 Y 0 39 8 COALESCE(c0, c0) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c0, c1) 253 (format=json) 30 1 Y 0 39 8 +def COALESCE(c0, c1) 253 30 1 Y 0 39 8 COALESCE(c0, c1) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c0, c2) 252 (format=json) 1020 1 Y 0 39 8 +def COALESCE(c0, c2) 252 1020 1 Y 0 39 8 COALESCE(c0, c2) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c0, c3) 250 (format=json) 262140 1 Y 0 39 8 +def COALESCE(c0, c3) 250 262140 1 Y 0 39 8 COALESCE(c0, c3) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c0, c4) 251 (format=json) 67108860 1 Y 0 39 8 +def COALESCE(c0, c4) 251 67108860 1 Y 0 39 8 COALESCE(c0, c4) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c0, c5) 251 (format=json) 4294967292 1 Y 0 39 8 +def COALESCE(c0, c5) 251 4294967292 1 Y 0 39 8 COALESCE(c0, c5) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -884,31 +884,31 @@ def COALESCE(c0, c6) 254 30 1 Y 0 39 8 COALESCE(c0, c6) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c0, c7) 253 30 1 Y 0 39 8 +def COALESCE(c0, c7) 254 (format=json) 30 1 Y 0 39 8 COALESCE(c0, c7) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c1, c0) 253 (format=json) 30 1 Y 0 39 8 +def COALESCE(c1, c0) 253 30 1 Y 0 39 8 COALESCE(c1, c0) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c1, c1) 253 (format=json) 30 1 Y 0 39 8 +def COALESCE(c1, c1) 253 30 1 Y 0 39 8 COALESCE(c1, c1) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c1, c2) 252 (format=json) 1020 1 Y 0 39 8 +def COALESCE(c1, c2) 252 1020 1 Y 0 39 8 COALESCE(c1, c2) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c1, c3) 250 (format=json) 262140 1 Y 0 39 8 +def COALESCE(c1, c3) 250 262140 1 Y 0 39 8 COALESCE(c1, c3) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c1, c4) 251 (format=json) 67108860 1 Y 0 39 8 +def COALESCE(c1, c4) 251 67108860 1 Y 0 39 8 COALESCE(c1, c4) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c1, c5) 251 (format=json) 4294967292 1 Y 0 39 8 +def COALESCE(c1, c5) 251 4294967292 1 Y 0 39 8 COALESCE(c1, c5) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -916,31 +916,31 @@ def COALESCE(c1, c6) 253 30 1 Y 0 39 8 COALESCE(c1, c6) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c1, c7) 253 30 1 Y 0 39 8 +def COALESCE(c1, c7) 253 (format=json) 30 1 Y 0 39 8 COALESCE(c1, c7) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c2, c0) 252 (format=json) 1020 1 Y 0 39 8 +def COALESCE(c2, c0) 252 1020 1 Y 0 39 8 COALESCE(c2, c0) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c2, c1) 252 (format=json) 1020 1 Y 0 39 8 +def COALESCE(c2, c1) 252 1020 1 Y 0 39 8 COALESCE(c2, c1) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c2, c2) 252 (format=json) 1020 1 Y 0 39 8 +def COALESCE(c2, c2) 252 1020 1 Y 0 39 8 COALESCE(c2, c2) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c2, c3) 250 (format=json) 262140 1 Y 0 39 8 +def COALESCE(c2, c3) 250 262140 1 Y 0 39 8 COALESCE(c2, c3) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c2, c4) 251 (format=json) 67108860 1 Y 0 39 8 +def COALESCE(c2, c4) 251 67108860 1 Y 0 39 8 COALESCE(c2, c4) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c2, c5) 251 (format=json) 4294967292 1 Y 0 39 8 +def COALESCE(c2, c5) 251 4294967292 1 Y 0 39 8 COALESCE(c2, c5) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -948,31 +948,31 @@ def COALESCE(c2, c6) 252 1020 1 Y 0 39 8 COALESCE(c2, c6) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c2, c7) 252 1020 1 Y 0 39 8 +def COALESCE(c2, c7) 252 (format=json) 1020 1 Y 0 39 8 COALESCE(c2, c7) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c3, c0) 250 (format=json) 262140 1 Y 0 39 8 +def COALESCE(c3, c0) 250 262140 1 Y 0 39 8 COALESCE(c3, c0) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c3, c1) 250 (format=json) 262140 1 Y 0 39 8 +def COALESCE(c3, c1) 250 262140 1 Y 0 39 8 COALESCE(c3, c1) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c3, c2) 250 (format=json) 262140 1 Y 0 39 8 +def COALESCE(c3, c2) 250 262140 1 Y 0 39 8 COALESCE(c3, c2) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c3, c3) 250 (format=json) 262140 1 Y 0 39 8 +def COALESCE(c3, c3) 250 262140 1 Y 0 39 8 COALESCE(c3, c3) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c3, c4) 251 (format=json) 67108860 1 Y 0 39 8 +def COALESCE(c3, c4) 251 67108860 1 Y 0 39 8 COALESCE(c3, c4) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c3, c5) 251 (format=json) 4294967292 1 Y 0 39 8 +def COALESCE(c3, c5) 251 4294967292 1 Y 0 39 8 COALESCE(c3, c5) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -980,31 +980,31 @@ def COALESCE(c3, c6) 250 262140 1 Y 0 39 8 COALESCE(c3, c6) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c3, c7) 250 262140 1 Y 0 39 8 +def COALESCE(c3, c7) 250 (format=json) 262140 1 Y 0 39 8 COALESCE(c3, c7) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c4, c0) 251 (format=json) 67108860 1 Y 0 39 8 +def COALESCE(c4, c0) 251 67108860 1 Y 0 39 8 COALESCE(c4, c0) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c4, c1) 251 (format=json) 67108860 1 Y 0 39 8 +def COALESCE(c4, c1) 251 67108860 1 Y 0 39 8 COALESCE(c4, c1) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c4, c2) 251 (format=json) 67108860 1 Y 0 39 8 +def COALESCE(c4, c2) 251 67108860 1 Y 0 39 8 COALESCE(c4, c2) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c4, c3) 251 (format=json) 67108860 1 Y 0 39 8 +def COALESCE(c4, c3) 251 67108860 1 Y 0 39 8 COALESCE(c4, c3) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c4, c4) 251 (format=json) 67108860 1 Y 0 39 8 +def COALESCE(c4, c4) 251 67108860 1 Y 0 39 8 COALESCE(c4, c4) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c4, c5) 251 (format=json) 4294967292 1 Y 0 39 8 +def COALESCE(c4, c5) 251 4294967292 1 Y 0 39 8 COALESCE(c4, c5) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -1012,31 +1012,31 @@ def COALESCE(c4, c6) 251 67108860 1 Y 0 39 8 COALESCE(c4, c6) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c4, c7) 251 67108860 1 Y 0 39 8 +def COALESCE(c4, c7) 251 (format=json) 67108860 1 Y 0 39 8 COALESCE(c4, c7) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c5, c0) 251 (format=json) 4294967292 1 Y 0 39 8 +def COALESCE(c5, c0) 251 4294967292 1 Y 0 39 8 COALESCE(c5, c0) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c5, c1) 251 (format=json) 4294967292 1 Y 0 39 8 +def COALESCE(c5, c1) 251 4294967292 1 Y 0 39 8 COALESCE(c5, c1) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c5, c2) 251 (format=json) 4294967292 1 Y 0 39 8 +def COALESCE(c5, c2) 251 4294967292 1 Y 0 39 8 COALESCE(c5, c2) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c5, c3) 251 (format=json) 4294967292 1 Y 0 39 8 +def COALESCE(c5, c3) 251 4294967292 1 Y 0 39 8 COALESCE(c5, c3) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c5, c4) 251 (format=json) 4294967292 1 Y 0 39 8 +def COALESCE(c5, c4) 251 4294967292 1 Y 0 39 8 COALESCE(c5, c4) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c5, c5) 251 (format=json) 4294967292 1 Y 0 39 8 +def COALESCE(c5, c5) 251 4294967292 1 Y 0 39 8 COALESCE(c5, c5) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -1044,7 +1044,7 @@ def COALESCE(c5, c6) 251 4294967292 1 Y 0 39 8 COALESCE(c5, c6) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c5, c7) 251 4294967292 1 Y 0 39 8 +def COALESCE(c5, c7) 251 (format=json) 4294967292 1 Y 0 39 8 COALESCE(c5, c7) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -1080,27 +1080,27 @@ def COALESCE(c6, c7) 253 11 1 Y 0 39 8 COALESCE(c6, c7) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c7, c0) 253 30 1 Y 0 39 8 +def COALESCE(c7, c0) 254 (format=json) 30 1 Y 0 39 8 COALESCE(c7, c0) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c7, c1) 253 30 1 Y 0 39 8 +def COALESCE(c7, c1) 253 (format=json) 30 1 Y 0 39 8 COALESCE(c7, c1) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c7, c2) 252 1020 1 Y 0 39 8 +def COALESCE(c7, c2) 252 (format=json) 1020 1 Y 0 39 8 COALESCE(c7, c2) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c7, c3) 250 262140 1 Y 0 39 8 +def COALESCE(c7, c3) 250 (format=json) 262140 1 Y 0 39 8 COALESCE(c7, c3) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c7, c4) 251 67108860 1 Y 0 39 8 +def COALESCE(c7, c4) 251 (format=json) 67108860 1 Y 0 39 8 COALESCE(c7, c4) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(c7, c5) 251 4294967292 1 Y 0 39 8 +def COALESCE(c7, c5) 251 (format=json) 4294967292 1 Y 0 39 8 COALESCE(c7, c5) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -1141,7 +1141,7 @@ def LEAST(c0, c6) 5 23 1 Y 32896 31 63 LEAST(c0, c6) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(c0, c7) 253 30 1 Y 0 39 8 +def LEAST(c0, c7) 254 (format=json) 30 1 Y 0 39 8 LEAST(c0, c7) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -1173,7 +1173,7 @@ def LEAST(c1, c6) 5 23 1 Y 32896 31 63 LEAST(c1, c6) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(c1, c7) 253 30 1 Y 0 39 8 +def LEAST(c1, c7) 253 (format=json) 30 1 Y 0 39 8 LEAST(c1, c7) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -1205,7 +1205,7 @@ def LEAST(c2, c6) 5 23 1 Y 32896 31 63 LEAST(c2, c6) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(c2, c7) 252 1020 1 Y 0 39 8 +def LEAST(c2, c7) 252 (format=json) 1020 1 Y 0 39 8 LEAST(c2, c7) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -1237,7 +1237,7 @@ def LEAST(c3, c6) 5 23 1 Y 32896 31 63 LEAST(c3, c6) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(c3, c7) 250 262140 1 Y 0 39 8 +def LEAST(c3, c7) 250 (format=json) 262140 1 Y 0 39 8 LEAST(c3, c7) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -1269,7 +1269,7 @@ def LEAST(c4, c6) 5 23 1 Y 32896 31 63 LEAST(c4, c6) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(c4, c7) 251 67108860 1 Y 0 39 8 +def LEAST(c4, c7) 251 (format=json) 67108860 1 Y 0 39 8 LEAST(c4, c7) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -1301,7 +1301,7 @@ def LEAST(c5, c6) 5 23 1 Y 32896 31 63 LEAST(c5, c6) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(c5, c7) 251 4294967292 1 Y 0 39 8 +def LEAST(c5, c7) 251 (format=json) 4294967292 1 Y 0 39 8 LEAST(c5, c7) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -1337,27 +1337,27 @@ def LEAST(c6, c7) 5 17 1 Y 32896 0 63 LEAST(c6, c7) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(c7, c0) 253 30 1 Y 0 39 8 +def LEAST(c7, c0) 254 (format=json) 30 1 Y 0 39 8 LEAST(c7, c0) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(c7, c1) 253 30 1 Y 0 39 8 +def LEAST(c7, c1) 253 (format=json) 30 1 Y 0 39 8 LEAST(c7, c1) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(c7, c2) 252 1020 1 Y 0 39 8 +def LEAST(c7, c2) 252 (format=json) 1020 1 Y 0 39 8 LEAST(c7, c2) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(c7, c3) 250 262140 1 Y 0 39 8 +def LEAST(c7, c3) 250 (format=json) 262140 1 Y 0 39 8 LEAST(c7, c3) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(c7, c4) 251 67108860 1 Y 0 39 8 +def LEAST(c7, c4) 251 (format=json) 67108860 1 Y 0 39 8 LEAST(c7, c4) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(c7, c5) 251 4294967292 1 Y 0 39 8 +def LEAST(c7, c5) 251 (format=json) 4294967292 1 Y 0 39 8 LEAST(c7, c5) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -1627,27 +1627,27 @@ c7+c7 2 CALL p2('COALESCE(t1.colt1, t2.colt2)'); Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c0, t2.c0) 254 30 1 Y 0 39 8 +def COALESCE(t1.c0, t2.c0) 254 (format=json) 30 1 Y 0 39 8 COALESCE(t1.c0, t2.c0) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c0, t2.c1) 253 30 1 Y 0 39 8 +def COALESCE(t1.c0, t2.c1) 254 (format=json) 30 1 Y 0 39 8 COALESCE(t1.c0, t2.c1) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c0, t2.c2) 252 1020 1 Y 0 39 8 +def COALESCE(t1.c0, t2.c2) 254 (format=json) 255 1 Y 0 39 8 COALESCE(t1.c0, t2.c2) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c0, t2.c3) 250 262140 1 Y 0 39 8 +def COALESCE(t1.c0, t2.c3) 254 (format=json) 65535 1 Y 0 39 8 COALESCE(t1.c0, t2.c3) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c0, t2.c4) 251 67108860 1 Y 0 39 8 +def COALESCE(t1.c0, t2.c4) 254 (format=json) 16777215 1 Y 0 39 8 COALESCE(t1.c0, t2.c4) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c0, t2.c5) 251 4294967292 1 Y 0 39 8 +def COALESCE(t1.c0, t2.c5) 254 (format=json) 1073741823 1 Y 0 39 8 COALESCE(t1.c0, t2.c5) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -1675,31 +1675,31 @@ def COALESCE(t1.c0, t2.c11) 254 30 1 Y 0 39 8 COALESCE(t1.c0, t2.c11) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c0, t2.c12) 253 30 1 Y 0 39 8 +def COALESCE(t1.c0, t2.c12) 254 (format=json) 30 1 Y 0 39 8 COALESCE(t1.c0, t2.c12) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c1, t2.c0) 253 30 1 Y 0 39 8 +def COALESCE(t1.c1, t2.c0) 253 (format=json) 30 1 Y 0 39 8 COALESCE(t1.c1, t2.c0) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c1, t2.c1) 253 30 1 Y 0 39 8 +def COALESCE(t1.c1, t2.c1) 253 (format=json) 30 1 Y 0 39 8 COALESCE(t1.c1, t2.c1) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c1, t2.c2) 252 1020 1 Y 0 39 8 +def COALESCE(t1.c1, t2.c2) 253 (format=json) 255 1 Y 0 39 8 COALESCE(t1.c1, t2.c2) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c1, t2.c3) 250 262140 1 Y 0 39 8 +def COALESCE(t1.c1, t2.c3) 253 (format=json) 65535 1 Y 0 39 8 COALESCE(t1.c1, t2.c3) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c1, t2.c4) 251 67108860 1 Y 0 39 8 +def COALESCE(t1.c1, t2.c4) 253 (format=json) 16777215 1 Y 0 39 8 COALESCE(t1.c1, t2.c4) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c1, t2.c5) 251 4294967292 1 Y 0 39 8 +def COALESCE(t1.c1, t2.c5) 253 (format=json) 1073741823 1 Y 0 39 8 COALESCE(t1.c1, t2.c5) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -1727,31 +1727,31 @@ def COALESCE(t1.c1, t2.c11) 253 30 1 Y 0 39 8 COALESCE(t1.c1, t2.c11) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c1, t2.c12) 253 30 1 Y 0 39 8 +def COALESCE(t1.c1, t2.c12) 253 (format=json) 30 1 Y 0 39 8 COALESCE(t1.c1, t2.c12) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c2, t2.c0) 252 1020 1 Y 0 39 8 +def COALESCE(t1.c2, t2.c0) 252 (format=json) 1020 1 Y 0 39 8 COALESCE(t1.c2, t2.c0) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c2, t2.c1) 252 1020 1 Y 0 39 8 +def COALESCE(t1.c2, t2.c1) 252 (format=json) 1020 1 Y 0 39 8 COALESCE(t1.c2, t2.c1) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c2, t2.c2) 252 1020 1 Y 0 39 8 +def COALESCE(t1.c2, t2.c2) 252 (format=json) 1020 1 Y 0 39 8 COALESCE(t1.c2, t2.c2) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c2, t2.c3) 250 262140 1 Y 0 39 8 +def COALESCE(t1.c2, t2.c3) 250 (format=json) 262140 1 Y 0 39 8 COALESCE(t1.c2, t2.c3) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c2, t2.c4) 251 67108860 1 Y 0 39 8 +def COALESCE(t1.c2, t2.c4) 251 (format=json) 67108860 1 Y 0 39 8 COALESCE(t1.c2, t2.c4) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c2, t2.c5) 251 4294967292 1 Y 0 39 8 +def COALESCE(t1.c2, t2.c5) 251 (format=json) 4294967292 1 Y 0 39 8 COALESCE(t1.c2, t2.c5) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -1779,31 +1779,31 @@ def COALESCE(t1.c2, t2.c11) 252 1020 1 Y 0 39 8 COALESCE(t1.c2, t2.c11) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c2, t2.c12) 252 1020 1 Y 0 39 8 +def COALESCE(t1.c2, t2.c12) 252 (format=json) 1020 1 Y 0 39 8 COALESCE(t1.c2, t2.c12) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c3, t2.c0) 250 262140 1 Y 0 39 8 +def COALESCE(t1.c3, t2.c0) 250 (format=json) 262140 1 Y 0 39 8 COALESCE(t1.c3, t2.c0) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c3, t2.c1) 250 262140 1 Y 0 39 8 +def COALESCE(t1.c3, t2.c1) 250 (format=json) 262140 1 Y 0 39 8 COALESCE(t1.c3, t2.c1) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c3, t2.c2) 250 262140 1 Y 0 39 8 +def COALESCE(t1.c3, t2.c2) 250 (format=json) 262140 1 Y 0 39 8 COALESCE(t1.c3, t2.c2) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c3, t2.c3) 250 262140 1 Y 0 39 8 +def COALESCE(t1.c3, t2.c3) 250 (format=json) 262140 1 Y 0 39 8 COALESCE(t1.c3, t2.c3) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c3, t2.c4) 251 67108860 1 Y 0 39 8 +def COALESCE(t1.c3, t2.c4) 251 (format=json) 67108860 1 Y 0 39 8 COALESCE(t1.c3, t2.c4) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c3, t2.c5) 251 4294967292 1 Y 0 39 8 +def COALESCE(t1.c3, t2.c5) 251 (format=json) 4294967292 1 Y 0 39 8 COALESCE(t1.c3, t2.c5) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -1831,31 +1831,31 @@ def COALESCE(t1.c3, t2.c11) 250 262140 1 Y 0 39 8 COALESCE(t1.c3, t2.c11) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c3, t2.c12) 250 262140 1 Y 0 39 8 +def COALESCE(t1.c3, t2.c12) 250 (format=json) 262140 1 Y 0 39 8 COALESCE(t1.c3, t2.c12) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c4, t2.c0) 251 67108860 1 Y 0 39 8 +def COALESCE(t1.c4, t2.c0) 251 (format=json) 67108860 1 Y 0 39 8 COALESCE(t1.c4, t2.c0) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c4, t2.c1) 251 67108860 1 Y 0 39 8 +def COALESCE(t1.c4, t2.c1) 251 (format=json) 67108860 1 Y 0 39 8 COALESCE(t1.c4, t2.c1) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c4, t2.c2) 251 67108860 1 Y 0 39 8 +def COALESCE(t1.c4, t2.c2) 251 (format=json) 67108860 1 Y 0 39 8 COALESCE(t1.c4, t2.c2) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c4, t2.c3) 251 67108860 1 Y 0 39 8 +def COALESCE(t1.c4, t2.c3) 251 (format=json) 67108860 1 Y 0 39 8 COALESCE(t1.c4, t2.c3) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c4, t2.c4) 251 67108860 1 Y 0 39 8 +def COALESCE(t1.c4, t2.c4) 251 (format=json) 67108860 1 Y 0 39 8 COALESCE(t1.c4, t2.c4) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c4, t2.c5) 251 4294967292 1 Y 0 39 8 +def COALESCE(t1.c4, t2.c5) 251 (format=json) 4294967292 1 Y 0 39 8 COALESCE(t1.c4, t2.c5) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -1883,31 +1883,31 @@ def COALESCE(t1.c4, t2.c11) 251 67108860 1 Y 0 39 8 COALESCE(t1.c4, t2.c11) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c4, t2.c12) 251 67108860 1 Y 0 39 8 +def COALESCE(t1.c4, t2.c12) 251 (format=json) 67108860 1 Y 0 39 8 COALESCE(t1.c4, t2.c12) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c5, t2.c0) 251 4294967292 1 Y 0 39 8 +def COALESCE(t1.c5, t2.c0) 251 (format=json) 4294967292 1 Y 0 39 8 COALESCE(t1.c5, t2.c0) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c5, t2.c1) 251 4294967292 1 Y 0 39 8 +def COALESCE(t1.c5, t2.c1) 251 (format=json) 4294967292 1 Y 0 39 8 COALESCE(t1.c5, t2.c1) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c5, t2.c2) 251 4294967292 1 Y 0 39 8 +def COALESCE(t1.c5, t2.c2) 251 (format=json) 4294967292 1 Y 0 39 8 COALESCE(t1.c5, t2.c2) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c5, t2.c3) 251 4294967292 1 Y 0 39 8 +def COALESCE(t1.c5, t2.c3) 251 (format=json) 4294967292 1 Y 0 39 8 COALESCE(t1.c5, t2.c3) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c5, t2.c4) 251 4294967292 1 Y 0 39 8 +def COALESCE(t1.c5, t2.c4) 251 (format=json) 4294967292 1 Y 0 39 8 COALESCE(t1.c5, t2.c4) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c5, t2.c5) 251 4294967292 1 Y 0 39 8 +def COALESCE(t1.c5, t2.c5) 251 (format=json) 4294967292 1 Y 0 39 8 COALESCE(t1.c5, t2.c5) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -1935,7 +1935,7 @@ def COALESCE(t1.c5, t2.c11) 251 4294967292 1 Y 0 39 8 COALESCE(t1.c5, t2.c11) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def COALESCE(t1.c5, t2.c12) 251 4294967292 1 Y 0 39 8 +def COALESCE(t1.c5, t2.c12) 251 (format=json) 4294967292 1 Y 0 39 8 COALESCE(t1.c5, t2.c12) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -2044,27 +2044,27 @@ COALESCE(t1.c7, t2.c12) 1 CALL p2('LEAST(t1.colt1, t2.colt2)'); Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c0, t2.c0) 254 30 1 Y 0 39 8 +def LEAST(t1.c0, t2.c0) 254 (format=json) 30 1 Y 0 39 8 LEAST(t1.c0, t2.c0) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c0, t2.c1) 253 30 1 Y 0 39 8 +def LEAST(t1.c0, t2.c1) 254 (format=json) 30 1 Y 0 39 8 LEAST(t1.c0, t2.c1) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c0, t2.c2) 252 1020 1 Y 0 39 8 +def LEAST(t1.c0, t2.c2) 254 (format=json) 255 1 Y 0 39 8 LEAST(t1.c0, t2.c2) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c0, t2.c3) 250 262140 1 Y 0 39 8 +def LEAST(t1.c0, t2.c3) 254 (format=json) 65535 1 Y 0 39 8 LEAST(t1.c0, t2.c3) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c0, t2.c4) 251 67108860 1 Y 0 39 8 +def LEAST(t1.c0, t2.c4) 254 (format=json) 16777215 1 Y 0 39 8 LEAST(t1.c0, t2.c4) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c0, t2.c5) 251 4294967292 1 Y 0 39 8 +def LEAST(t1.c0, t2.c5) 254 (format=json) 1073741823 1 Y 0 39 8 LEAST(t1.c0, t2.c5) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -2092,31 +2092,31 @@ def LEAST(t1.c0, t2.c11) 12 26 26 Y 128 6 63 LEAST(t1.c0, t2.c11) 0000-00-00 00:00:00.000000 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c0, t2.c12) 253 30 1 Y 0 39 8 +def LEAST(t1.c0, t2.c12) 254 (format=json) 30 1 Y 0 39 8 LEAST(t1.c0, t2.c12) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c1, t2.c0) 253 30 1 Y 0 39 8 +def LEAST(t1.c1, t2.c0) 253 (format=json) 30 1 Y 0 39 8 LEAST(t1.c1, t2.c0) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c1, t2.c1) 253 30 1 Y 0 39 8 +def LEAST(t1.c1, t2.c1) 253 (format=json) 30 1 Y 0 39 8 LEAST(t1.c1, t2.c1) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c1, t2.c2) 252 1020 1 Y 0 39 8 +def LEAST(t1.c1, t2.c2) 253 (format=json) 255 1 Y 0 39 8 LEAST(t1.c1, t2.c2) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c1, t2.c3) 250 262140 1 Y 0 39 8 +def LEAST(t1.c1, t2.c3) 253 (format=json) 65535 1 Y 0 39 8 LEAST(t1.c1, t2.c3) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c1, t2.c4) 251 67108860 1 Y 0 39 8 +def LEAST(t1.c1, t2.c4) 253 (format=json) 16777215 1 Y 0 39 8 LEAST(t1.c1, t2.c4) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c1, t2.c5) 251 4294967292 1 Y 0 39 8 +def LEAST(t1.c1, t2.c5) 253 (format=json) 1073741823 1 Y 0 39 8 LEAST(t1.c1, t2.c5) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -2144,31 +2144,31 @@ def LEAST(t1.c1, t2.c11) 12 26 26 Y 128 6 63 LEAST(t1.c1, t2.c11) 0000-00-00 00:00:00.000000 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c1, t2.c12) 253 30 1 Y 0 39 8 +def LEAST(t1.c1, t2.c12) 253 (format=json) 30 1 Y 0 39 8 LEAST(t1.c1, t2.c12) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c2, t2.c0) 252 1020 1 Y 0 39 8 +def LEAST(t1.c2, t2.c0) 252 (format=json) 1020 1 Y 0 39 8 LEAST(t1.c2, t2.c0) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c2, t2.c1) 252 1020 1 Y 0 39 8 +def LEAST(t1.c2, t2.c1) 252 (format=json) 1020 1 Y 0 39 8 LEAST(t1.c2, t2.c1) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c2, t2.c2) 252 1020 1 Y 0 39 8 +def LEAST(t1.c2, t2.c2) 252 (format=json) 1020 1 Y 0 39 8 LEAST(t1.c2, t2.c2) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c2, t2.c3) 250 262140 1 Y 0 39 8 +def LEAST(t1.c2, t2.c3) 250 (format=json) 262140 1 Y 0 39 8 LEAST(t1.c2, t2.c3) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c2, t2.c4) 251 67108860 1 Y 0 39 8 +def LEAST(t1.c2, t2.c4) 251 (format=json) 67108860 1 Y 0 39 8 LEAST(t1.c2, t2.c4) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c2, t2.c5) 251 4294967292 1 Y 0 39 8 +def LEAST(t1.c2, t2.c5) 251 (format=json) 4294967292 1 Y 0 39 8 LEAST(t1.c2, t2.c5) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -2196,31 +2196,31 @@ def LEAST(t1.c2, t2.c11) 12 26 26 Y 128 6 63 LEAST(t1.c2, t2.c11) 0000-00-00 00:00:00.000000 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c2, t2.c12) 252 1020 1 Y 0 39 8 +def LEAST(t1.c2, t2.c12) 252 (format=json) 1020 1 Y 0 39 8 LEAST(t1.c2, t2.c12) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c3, t2.c0) 250 262140 1 Y 0 39 8 +def LEAST(t1.c3, t2.c0) 250 (format=json) 262140 1 Y 0 39 8 LEAST(t1.c3, t2.c0) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c3, t2.c1) 250 262140 1 Y 0 39 8 +def LEAST(t1.c3, t2.c1) 250 (format=json) 262140 1 Y 0 39 8 LEAST(t1.c3, t2.c1) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c3, t2.c2) 250 262140 1 Y 0 39 8 +def LEAST(t1.c3, t2.c2) 250 (format=json) 262140 1 Y 0 39 8 LEAST(t1.c3, t2.c2) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c3, t2.c3) 250 262140 1 Y 0 39 8 +def LEAST(t1.c3, t2.c3) 250 (format=json) 262140 1 Y 0 39 8 LEAST(t1.c3, t2.c3) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c3, t2.c4) 251 67108860 1 Y 0 39 8 +def LEAST(t1.c3, t2.c4) 251 (format=json) 67108860 1 Y 0 39 8 LEAST(t1.c3, t2.c4) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c3, t2.c5) 251 4294967292 1 Y 0 39 8 +def LEAST(t1.c3, t2.c5) 251 (format=json) 4294967292 1 Y 0 39 8 LEAST(t1.c3, t2.c5) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -2248,31 +2248,31 @@ def LEAST(t1.c3, t2.c11) 12 26 26 Y 128 6 63 LEAST(t1.c3, t2.c11) 0000-00-00 00:00:00.000000 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c3, t2.c12) 250 262140 1 Y 0 39 8 +def LEAST(t1.c3, t2.c12) 250 (format=json) 262140 1 Y 0 39 8 LEAST(t1.c3, t2.c12) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c4, t2.c0) 251 67108860 1 Y 0 39 8 +def LEAST(t1.c4, t2.c0) 251 (format=json) 67108860 1 Y 0 39 8 LEAST(t1.c4, t2.c0) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c4, t2.c1) 251 67108860 1 Y 0 39 8 +def LEAST(t1.c4, t2.c1) 251 (format=json) 67108860 1 Y 0 39 8 LEAST(t1.c4, t2.c1) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c4, t2.c2) 251 67108860 1 Y 0 39 8 +def LEAST(t1.c4, t2.c2) 251 (format=json) 67108860 1 Y 0 39 8 LEAST(t1.c4, t2.c2) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c4, t2.c3) 251 67108860 1 Y 0 39 8 +def LEAST(t1.c4, t2.c3) 251 (format=json) 67108860 1 Y 0 39 8 LEAST(t1.c4, t2.c3) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c4, t2.c4) 251 67108860 1 Y 0 39 8 +def LEAST(t1.c4, t2.c4) 251 (format=json) 67108860 1 Y 0 39 8 LEAST(t1.c4, t2.c4) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c4, t2.c5) 251 4294967292 1 Y 0 39 8 +def LEAST(t1.c4, t2.c5) 251 (format=json) 4294967292 1 Y 0 39 8 LEAST(t1.c4, t2.c5) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -2300,31 +2300,31 @@ def LEAST(t1.c4, t2.c11) 12 26 26 Y 128 6 63 LEAST(t1.c4, t2.c11) 0000-00-00 00:00:00.000000 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c4, t2.c12) 251 67108860 1 Y 0 39 8 +def LEAST(t1.c4, t2.c12) 251 (format=json) 67108860 1 Y 0 39 8 LEAST(t1.c4, t2.c12) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c5, t2.c0) 251 4294967292 1 Y 0 39 8 +def LEAST(t1.c5, t2.c0) 251 (format=json) 4294967292 1 Y 0 39 8 LEAST(t1.c5, t2.c0) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c5, t2.c1) 251 4294967292 1 Y 0 39 8 +def LEAST(t1.c5, t2.c1) 251 (format=json) 4294967292 1 Y 0 39 8 LEAST(t1.c5, t2.c1) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c5, t2.c2) 251 4294967292 1 Y 0 39 8 +def LEAST(t1.c5, t2.c2) 251 (format=json) 4294967292 1 Y 0 39 8 LEAST(t1.c5, t2.c2) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c5, t2.c3) 251 4294967292 1 Y 0 39 8 +def LEAST(t1.c5, t2.c3) 251 (format=json) 4294967292 1 Y 0 39 8 LEAST(t1.c5, t2.c3) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c5, t2.c4) 251 4294967292 1 Y 0 39 8 +def LEAST(t1.c5, t2.c4) 251 (format=json) 4294967292 1 Y 0 39 8 LEAST(t1.c5, t2.c4) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c5, t2.c5) 251 4294967292 1 Y 0 39 8 +def LEAST(t1.c5, t2.c5) 251 (format=json) 4294967292 1 Y 0 39 8 LEAST(t1.c5, t2.c5) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -2352,7 +2352,7 @@ def LEAST(t1.c5, t2.c11) 12 26 26 Y 128 6 63 LEAST(t1.c5, t2.c11) 0000-00-00 00:00:00.000000 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def LEAST(t1.c5, t2.c12) 251 4294967292 1 Y 0 39 8 +def LEAST(t1.c5, t2.c12) 251 (format=json) 4294967292 1 Y 0 39 8 LEAST(t1.c5, t2.c12) 1 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr diff --git a/plugin/type_json/mysql-test/type_json/r/type_json.result b/plugin/type_json/mysql-test/type_json/r/type_json.result new file mode 100644 index 0000000000000..2d138dbb9d86f --- /dev/null +++ b/plugin/type_json/mysql-test/type_json/r/type_json.result @@ -0,0 +1,172 @@ +create or replace table t1(a json); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci +create or replace table t1(a json character set utf8); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci +create or replace table t1(a json default '{a:1}'); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '{a:1}' +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci +create or replace table t1(a json not null); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci +insert t1 values ('[]'); +insert t1 values ('a'); +set timestamp=unix_timestamp('2010:11:12 13:14:15'); +create or replace table t1(a json default(json_object('now', now()))); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT json_object('now',current_timestamp()) +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci +insert t1 values (); +select * from t1; +a +{"now": "2010-11-12 13:14:15"} +drop table t1; +create table t1 (t json) as select json_quote('foo') as t; +create table t2 (a json) as select json_quote('foo') as t; +create table t3 like t1; +select * from t1; +t +"foo" +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `t` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, + `t` varchar(38) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci +show create table t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `t` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci +drop table t1,t2,t3; +create table t1 (t json check (length(t) > 0)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `t` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (octet_length(`t`) > 0) +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci +drop table t1; +create table t1 (t text) engine=myisam; +insert into t1 values ("{}"),(""); +create table t2 (t json) select t from t1; +select * from t2; +t +{} + +drop table t1, t2; +create or replace table t1(a json default(json_object('now', 1)) check (json_valid(a))); +insert into t1 values (); +insert into t1 values ("{}"); +insert into t1 values ("xxx"); +ERROR 23000: CONSTRAINT `t1.a` failed for `test`.`t1` +select * from t1; +a +{"now": 1} +{} +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT json_object('now',1) CHECK (json_valid(`a`)) +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci +drop table t1; +# +# Start of 10.5 tests +# +# +# MDEV-17832 Protocol: extensions for Pluggable types and JSON, GEOMETRY +# +SET NAMES utf8; +CREATE TABLE t1 ( +js0 JSON, +js1 TEXT CHECK (JSON_VALID(js1)), +js2 TEXT CHECK (LENGTH(js2) > 0 AND JSON_VALID(js2)), +js3 TEXT CHECK (LENGTH(js2) > 0 OR JSON_VALID(js2)) +) CHARACTER SET utf8; +SELECT * FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 js0 js0 252 4294967295 0 Y 144 0 192 +def test t1 t1 js1 js1 252 (format=json) 196605 0 Y 16 0 192 +def test t1 t1 js2 js2 252 (format=json) 196605 0 Y 16 0 192 +def test t1 t1 js3 js3 252 196605 0 Y 16 0 192 +js0 js1 js2 js3 +SELECT js0, JSON_COMPACT(js0), JSON_COMPACT('{}') FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 js0 js0 252 4294967295 0 Y 144 0 192 +def JSON_COMPACT(js0) 251 (format=json) 4294967295 0 Y 128 0 192 +def JSON_COMPACT('{}') 253 (format=json) 6 0 Y 0 0 192 +js0 JSON_COMPACT(js0) JSON_COMPACT('{}') +DROP TABLE t1; +# +# MDEV-27361 Hybrid functions with JSON arguments do not send format metadata +# +CREATE TABLE t1 (a JSON); +INSERT INTO t1 VALUES ('{"a":"b"}'); +SELECT a, JSON_COMPACT(a), COALESCE(a) FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a a 252 4294967295 9 Y 144 0 192 +def JSON_COMPACT(a) 251 (format=json) 4294967295 9 Y 128 0 192 +def COALESCE(a) 251 4294967295 9 Y 128 39 192 +a JSON_COMPACT(a) COALESCE(a) +{"a":"b"} {"a":"b"} {"a":"b"} +SELECT JSON_ARRAYAGG(1), JSON_ARRAYAGG(a) FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def JSON_ARRAYAGG(1) 252 (format=json) 9437184 3 Y 0 0 192 +def JSON_ARRAYAGG(a) 252 (format=json) 12582912 17 Y 128 0 192 +JSON_ARRAYAGG(1) JSON_ARRAYAGG(a) +[1] ["{\"a\":\"b\"}"] +SELECT JSON_OBJECTAGG('a','b'), JSON_OBJECTAGG('a',a) FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def JSON_OBJECTAGG('a','b') 252 (format=json) 9437184 9 Y 0 0 192 +def JSON_OBJECTAGG('a',a) 252 (format=json) 12582912 21 Y 128 0 192 +JSON_OBJECTAGG('a','b') JSON_OBJECTAGG('a',a) +{"a":"b"} {"a":"{\"a\":\"b\"}"} +DROP TABLE t1; +# +# MDEV-27018 IF and COALESCE lose "json" property +# +SELECT json_object('a', (SELECT json_objectagg(b, c) FROM (SELECT 'b','c') d)) AS j FROM DUAL; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def j 250 (format=json) 9437310 16 Y 0 39 192 +j +{"a": {"b":"c"}} +# +# MDEV-26506 Over-quoted JSON when combining JSON_ARRAYAGG with JSON_OBJECT +# +# maintain JSON property through internal temporary tables +create table t1 (a varchar(30)); +insert into t1 values ('root'); +select json_object('attr2',o) from (select a, json_arrayagg(json_object('attr1', a)) as o from t1) u; +json_object('attr2',o) +{"attr2": [{"attr1": "root"}]} +drop table t1; +create view v1 as select json_object(_latin1 'a', _latin1'b') as v1_json; +select v1_json from v1; +v1_json +{"a": "b"} +select json_arrayagg(v1_json) from v1; +json_arrayagg(v1_json) +[{"a": "b"}] +drop view v1; +# +# End of 10.5 tests +# diff --git a/plugin/type_json/mysql-test/type_json/r/type_json_basic.result b/plugin/type_json/mysql-test/type_json/r/type_json_basic.result new file mode 100644 index 0000000000000..38abdde36ca58 --- /dev/null +++ b/plugin/type_json/mysql-test/type_json/r/type_json_basic.result @@ -0,0 +1,53 @@ +create or replace table t1(a json); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci +create or replace table t1(a json character set utf8); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci +create or replace table t1(a json default '{a:1}'); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '{a:1}' +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci +set timestamp=unix_timestamp('2010:11:12 13:14:15'); +create or replace table t1(a json default(json_object('now', now()))); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT json_object('now',current_timestamp()) +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci +insert t1 values (); +select * from t1; +a +{"now": "2010-11-12 13:14:15"} +drop table t1; +create table t1 (t json) as select json_quote('foo') as t; +create table t2 (a json) as select json_quote('foo') as t; +create table t3 like t1; +select * from t1; +t +"foo" +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `t` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, + `t` varchar(38) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci +show create table t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `t` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci +drop table t1,t2,t3; diff --git a/plugin/type_json/mysql-test/type_json/t/type_json.test b/plugin/type_json/mysql-test/type_json/t/type_json.test new file mode 100644 index 0000000000000..248703d62e4c6 --- /dev/null +++ b/plugin/type_json/mysql-test/type_json/t/type_json.test @@ -0,0 +1,169 @@ +# +# JSON data type (plugin version) +# Mapped from mysql-test/main/type_json.test +# + +create or replace table t1(a json); +show create table t1; + +create or replace table t1(a json character set utf8); +show create table t1; + +create or replace table t1(a json default '{a:1}'); +show create table t1; + +# TODO: implicit validation (in progress so will fail now) +create or replace table t1(a json not null check (json_valid(a))); +show create table t1; +insert t1 values ('[]'); +#--error ER_CONSTRAINT_FAILED +insert t1 values ('a'); + +# TODO: implicit validation (in progress so will fail now) +create or replace table t1(a json not null); +show create table t1; +insert t1 values ('[]'); +#--error ER_CONSTRAINT_FAILED +insert t1 values ('a'); + +set timestamp=unix_timestamp('2010:11:12 13:14:15'); +create or replace table t1(a json default(json_object('now', now()))); +show create table t1; +insert t1 values (); +select * from t1; +drop table t1; + +create table t1 (t json) as select json_quote('foo') as t; +create table t2 (a json) as select json_quote('foo') as t; +create table t3 like t1; +select * from t1; +show create table t1; +show create table t2; +show create table t3; +drop table t1,t2,t3; + +create table t1 (t json check (length(t) > 0)); +show create table t1; +drop table t1; + +create table t1 (t text) engine=myisam; +insert into t1 values ("{}"),(""); +create table t2 (t json) select t from t1; +# TODO: implicit validation (in progress so will fail now) +--error ER_NO_SUCH_TABLE +select * from t2; +drop table t1, t2; + +create or replace table t1(a json default(json_object('now', 1)) check (json_valid(a))); +insert into t1 values (); +insert into t1 values ("{}"); +# TODO: implicit validation (in progress so will fail now) +--error ER_CONSTRAINT_FAILED +insert into t1 values ("xxx"); +select * from t1; +show create table t1; +drop table t1; + +# +# Test 11: CAST to TEXT and JSON - both parse errors in builtin +# CAST to json remains a parse error (plugin does not add CAST support) +# CAST to text remains a parse error (not a valid CAST target) +# (same as builtin: line 63-66) +# +# --error ER_PARSE_ERROR +#select cast('{a:1}' as text); +#--error ER_PARSE_ERROR +#select cast('{a:1}' as json); + +--echo # +--echo # Start of 10.5 tests +--echo # + +--echo # +--echo # MDEV-17832 Protocol: extensions for Pluggable types and JSON, GEOMETRY +--echo # + +# +# Test 12: Metadata extensions - JSON format in protocol +# (same as builtin: line 76-91) +# +SET NAMES utf8; +CREATE TABLE t1 ( + js0 JSON, + js1 TEXT CHECK (JSON_VALID(js1)), + js2 TEXT CHECK (LENGTH(js2) > 0 AND JSON_VALID(js2)), + js3 TEXT CHECK (LENGTH(js2) > 0 OR JSON_VALID(js2)) +) CHARACTER SET utf8; +--disable_view_protocol +--disable_ps_protocol +--enable_metadata +SELECT * FROM t1; +SELECT js0, JSON_COMPACT(js0), JSON_COMPACT('{}') FROM t1; +--disable_metadata +--enable_ps_protocol +--enable_view_protocol +DROP TABLE t1; + +--echo # +--echo # MDEV-27361 Hybrid functions with JSON arguments do not send format metadata +--echo # + +# +# Test 13: Hybrid functions (COALESCE, JSON_ARRAYAGG, JSON_OBJECTAGG) metadata +# (same as builtin: line 98-109) +# +CREATE TABLE t1 (a JSON); +INSERT INTO t1 VALUES ('{"a":"b"}'); +--disable_view_protocol +--disable_ps_protocol +--enable_metadata +SELECT a, JSON_COMPACT(a), COALESCE(a) FROM t1; +SELECT JSON_ARRAYAGG(1), JSON_ARRAYAGG(a) FROM t1; +SELECT JSON_OBJECTAGG('a','b'), JSON_OBJECTAGG('a',a) FROM t1; +--disable_metadata +--disable_ps_protocol +--enable_view_protocol +DROP TABLE t1; + +--echo # +--echo # MDEV-27018 IF and COALESCE lose "json" property +--echo # + +# +# Test 14: Subquery with JSON aggregation preserves json property +# (same as builtin: line 116-122) +# +--disable_view_protocol +--disable_ps_protocol +--enable_metadata +SELECT json_object('a', (SELECT json_objectagg(b, c) FROM (SELECT 'b','c') d)) AS j FROM DUAL; +--disable_metadata +--disable_ps_protocol +--enable_view_protocol + +--echo # +--echo # MDEV-26506 Over-quoted JSON when combining JSON_ARRAYAGG with JSON_OBJECT +--echo # + +# +# Test 15: JSON property through internal temporary tables +# (same as builtin: line 128-131) +# +--echo # maintain JSON property through internal temporary tables +create table t1 (a varchar(30)); +insert into t1 values ('root'); +select json_object('attr2',o) from (select a, json_arrayagg(json_object('attr1', a)) as o from t1) u; +drop table t1; + +# +# Test 16: JSON in views with charset introducers +# (same as builtin: line 133-136) +# +create view v1 as select json_object(_latin1 'a', _latin1'b') as v1_json; +select v1_json from v1; +select json_arrayagg(v1_json) from v1; +drop view v1; + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/plugin/type_json/mysql-test/type_json/t/type_json_basic.test b/plugin/type_json/mysql-test/type_json/t/type_json_basic.test new file mode 100644 index 0000000000000..8a14fab53261f --- /dev/null +++ b/plugin/type_json/mysql-test/type_json/t/type_json_basic.test @@ -0,0 +1,29 @@ +# +# JSON data type (plugin version) - Basic Operations +# Mapped from mysql-test/main/type_json.test +# + +create or replace table t1(a json); +show create table t1; + +create or replace table t1(a json character set utf8); +show create table t1; + +create or replace table t1(a json default '{a:1}'); +show create table t1; + +set timestamp=unix_timestamp('2010:11:12 13:14:15'); +create or replace table t1(a json default(json_object('now', now()))); +show create table t1; +insert t1 values (); +select * from t1; +drop table t1; + +create table t1 (t json) as select json_quote('foo') as t; +create table t2 (a json) as select json_quote('foo') as t; +create table t3 like t1; +select * from t1; +show create table t1; +show create table t2; +show create table t3; +drop table t1,t2,t3; diff --git a/plugin/type_json/mysql-test/type_json/type_json.result b/plugin/type_json/mysql-test/type_json/t/type_json_cast.test similarity index 100% rename from plugin/type_json/mysql-test/type_json/type_json.result rename to plugin/type_json/mysql-test/type_json/t/type_json_cast.test diff --git a/plugin/type_json/mysql-test/type_json/type_json.test b/plugin/type_json/mysql-test/type_json/t/type_json_protocol.test similarity index 100% rename from plugin/type_json/mysql-test/type_json/type_json.test rename to plugin/type_json/mysql-test/type_json/t/type_json_protocol.test diff --git a/plugin/type_json/mysql-test/type_json/t/type_json_validation.test b/plugin/type_json/mysql-test/type_json/t/type_json_validation.test new file mode 100644 index 0000000000000..f6a9e3f9eb89a --- /dev/null +++ b/plugin/type_json/mysql-test/type_json/t/type_json_validation.test @@ -0,0 +1,40 @@ +# +# JSON data type (plugin version) - Validation and Constraints +# Mapped from mysql-test/main/type_json.test +# + +# TODO: implicit validation (in progress so will fail now) +create or replace table t1(a json not null check (json_valid(a))); +show create table t1; +insert t1 values ('[]'); +#--error ER_CONSTRAINT_FAILED +insert t1 values ('a'); + +# TODO: implicit validation (in progress so will fail now) +create or replace table t1(a json not null); +show create table t1; +insert t1 values ('[]'); +#--error ER_CONSTRAINT_FAILED +insert t1 values ('a'); + +create table t1 (t json check (length(t) > 0)); +show create table t1; +drop table t1; + +create table t1 (t text) engine=myisam; +insert into t1 values ("{}"),(""); +create table t2 (t json) select t from t1; +# TODO: implicit validation (in progress so will fail now) +--error ER_NO_SUCH_TABLE +select * from t2; +drop table t1, t2; + +create or replace table t1(a json default(json_object('now', 1)) check (json_valid(a))); +insert into t1 values (); +insert into t1 values ("{}"); +# TODO: implicit validation (in progress so will fail now) +--error ER_CONSTRAINT_FAILED +insert into t1 values ("xxx"); +select * from t1; +show create table t1; +drop table t1; diff --git a/plugin/type_json/sql_type_json.cc b/plugin/type_json/sql_type_json.cc index 8d58efbbe9f1d..1445742cd815c 100644 --- a/plugin/type_json/sql_type_json.cc +++ b/plugin/type_json/sql_type_json.cc @@ -1,7 +1,110 @@ #define MYSQL_SERVER #include "mariadb.h" #include "sql_type_json.h" +#include "sql_class.h" +#include "sql_lex.h" +Type_handler_json type_handler_json; +Type_collection_json type_collection_json; +const Type_collection *Type_handler_json::type_collection() const +{ + return &type_collection_json; +} -Type_handler_json type_handler_json; \ No newline at end of file +bool Type_handler_json::Column_definition_prepare_stage1( + THD *thd, MEM_ROOT *root, Column_definition *def, + column_definition_type_t type, + const Column_derived_attributes *derived_attr) const +{ + def->charset= &my_charset_utf8mb4_bin; + if (Type_handler_long_blob::Column_definition_prepare_stage1( + thd, root, def, type, derived_attr)) + return true; + return false; +} + +Field *Type_handler_json::make_table_field(MEM_ROOT *root, + const LEX_CSTRING *name, + const Record_addr &addr, + const Type_all_attributes &attr, + TABLE_SHARE *share) const +{ + return new (root) Field_json(addr.ptr(), addr.null_ptr(), addr.null_bit(), + Field::NONE, name, share, attr.collation); +} + +Field *Type_handler_json::make_table_field_from_def( + TABLE_SHARE *share, MEM_ROOT *root, const LEX_CSTRING *name, + const Record_addr &rec, const Bit_addr &bit, + const Column_definition_attributes *attr, uint32 flags) const +{ + return new (root) Field_json(rec.ptr(), rec.null_ptr(), rec.null_bit(), + attr->unireg_check, name, share, attr->charset); +} + +Field *Type_handler_json::make_conversion_table_field( + MEM_ROOT *root, TABLE *table, uint metadata, const Field *target) const +{ + /* A JSON field uses 4 bytes for length as json file is a long blob*/ + uint pack_length= metadata & 0x00ff; + if (pack_length != 4) + return NULL; + + return new (root) Field_json(NULL, (uchar *) "", 1, Field::NONE, + &empty_clex_str, table->s, target->charset()); +} + +/********************Type collection json *******************/ + +const Type_handler * +Type_collection_json::aggregate_for_comparison(const Type_handler *a, + const Type_handler *b) const +{ + if (a->type_collection() == this) + swap_variables(const Type_handler *, a, b); + if (a == &type_handler_json || a == &type_handler_hex_hybrid || + a == &type_handler_tiny_blob || a == &type_handler_blob || + a == &type_handler_medium_blob || a == &type_handler_long_blob || + a == &type_handler_varchar || a == &type_handler_string || + a == &type_handler_null) + return b; + return NULL; +} + +const Type_handler * +Type_collection_json::aggregate_for_result(const Type_handler *a, + const Type_handler *b) const +{ + return aggregate_for_comparison(a, b); +} + +const Type_handler * +Type_collection_json::aggregate_for_min_max(const Type_handler *a, + const Type_handler *b) const +{ + return aggregate_for_comparison(a, b); +} + +const Type_handler * +Type_collection_json::aggregate_for_num_op(const Type_handler *a, + const Type_handler *b) const +{ + return NULL; +} + +/********************** Field_json *************************/ + +void Field_json::sql_type(String &res) const +{ + res.set_ascii(STRING_WITH_LEN("json")); +} + +int Field_json::report_wrong_value(const ErrConv &val) +{ + get_thd()->push_warning_truncated_value_for_field( + Sql_condition::WARN_LEVEL_WARN, "json", val.ptr(), table->s->db.str, + table->s->table_name.str, field_name.str); + reset(); + return 1; +} diff --git a/plugin/type_json/sql_type_json.h b/plugin/type_json/sql_type_json.h index 0a4b53c04c75f..53078468baa2d 100644 --- a/plugin/type_json/sql_type_json.h +++ b/plugin/type_json/sql_type_json.h @@ -1,44 +1,104 @@ #ifndef SQL_TYPE_JSON_PLUGIN_INCLUDED #define SQL_TYPE_JSON_PLUGIN_INCLUDED - #include "mariadb.h" #include "sql_type.h" -class Type_handler_json: public Type_handler_long_blob{ +class Type_handler_json : public Type_handler_long_blob +{ +public: + virtual ~Type_handler_json() { } + bool Item_append_extended_type_info(Send_field_extended_metadata *to, + const Item *item) const override + { + static const LEX_CSTRING fmt= {STRING_WITH_LEN("json")}; + return to->set_format_name(fmt); + } + const Type_collection *type_collection() const override; + uint get_column_attributes() const override { return ATTR_CHARSET; } + bool Column_definition_prepare_stage1(THD *thd, + MEM_ROOT *mem_root, + Column_definition *def, + column_definition_type_t type, + const Column_derived_attributes + *derived_attr) const override; + Field *make_table_field(MEM_ROOT *root, const LEX_CSTRING *name, + const Record_addr &addr, const Type_all_attributes &attr, + TABLE_SHARE *share) const override; + + Field *make_table_field_from_def(TABLE_SHARE *share, MEM_ROOT *mem_root, + const LEX_CSTRING *name, const Record_addr &addr, + const Bit_addr &bit, const Column_definition_attributes *attr, + uint32 flags) const override; + Field *make_conversion_table_field(MEM_ROOT *root, + TABLE *table, uint metadata, + const Field *target) const override; + // const Type_handler *type_handler_for_comparison() const override; + // const Type_handler *type_handler_for_tmp_table(const Item *item) const + // override; + // bool Item_hybrid_func_fix_attributes(THD *thd, const LEX_CSTRING &func_name, + // Type_handler_hybrid_field_type *handler, Type_all_attributes *func, + // Item **items, uint nitems) const override; + // virtual Item *create_typecast_item(THD *thd, Item *item, + // const Type_cast_attributes &attr) const override; + // Item *make_constructor_item(THD *thd, List *args) const override; - + bool can_return_int() const override { return false; } + bool can_return_decimal() const override { return false; } + bool can_return_real() const override { return false; } + bool can_return_date() const override { return false; } + bool can_return_time() const override { return false; } + }; extern Type_handler_json type_handler_json; +class Type_collection_json: public Type_collection +{ +public: + const Type_handler *aggregate_for_result(const Type_handler *a, + const Type_handler *b) + const override; + + const Type_handler *aggregate_for_min_max(const Type_handler *a, + const Type_handler *b) + const override; + + const Type_handler *aggregate_for_comparison(const Type_handler *a, + const Type_handler *b) + const override; + + const Type_handler *aggregate_for_num_op(const Type_handler *a, + const Type_handler *b) + const override; +}; + + #include "field.h" -class Field_json:public Field_blob +class Field_json : public Field_blob { + int report_wrong_value(const ErrConv &val); public: - Field_json(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, + Field_json(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg, - TABLE_SHARE *share, uint blob_pack_length, - const DTCollation &collation) + TABLE_SHARE *share, const DTCollation &collation) : Field_blob(ptr_arg, null_ptr_arg, null_bit_arg, unireg_check_arg, - field_name_arg, share, blob_pack_length, collation) - {} - const Type_handler *type_handler() const override - { - return &type_handler_json; - } - - void sql_type(String $str) const override; + field_name_arg, share, 4 /* blob_pack_length */, collation) + { + } + const Type_handler *type_handler() const override + { + return &type_handler_json; + } - uint size_of() const override { - return sizeof(*this); - } + void sql_type(String &str) const override; + uint size_of() const override { return sizeof(*this); } }; #endif // SQL_TYPE_JSON_INCLUDED diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 269d497058c2f..12086989175a0 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -6816,10 +6816,6 @@ field_type_lob: { $$.set(&type_handler_long_blob, $2); } | LONG_SYM opt_binary_and_compression { $$.set(&type_handler_medium_blob, $2); } - | JSON_SYM opt_compressed - { - $$.set(&type_handler_long_blob_json, &MY_CHARSET_UTF8MB4_BIN); - } ; field_type_misc: @@ -17315,6 +17311,7 @@ reserved_keyword_udt_not_param_type: | IS | ITERATE_SYM | JOIN_SYM + | JSON_SYM | KEYS | KEY_SYM | KILL_SYM From d9f6818cf49e4d87d0263e5e327640d917a94a3f Mon Sep 17 00:00:00 2001 From: Hadeer Ramadan Date: Wed, 24 Jun 2026 10:18:05 +0000 Subject: [PATCH 3/4] Keep JSON tests in the main suite to confirm they are always run. Fix Field_json::report_wrong_value to handle nulls safely. --- mysql-test/main/type_json.result | 47 +++-- mysql-test/main/type_json.test | 18 +- .../mysql-test/type_json/r/type_json.result | 172 ------------------ .../type_json/r/type_json_basic.result | 53 ------ .../type_json/mysql-test/type_json/suite.pm | 0 .../mysql-test/type_json/t/type_json.test | 169 ----------------- .../type_json/t/type_json_basic.test | 29 --- .../type_json/t/type_json_cast.test | 0 .../type_json/t/type_json_protocol.test | 0 .../type_json/t/type_json_validation.test | 40 ---- plugin/type_json/plugin.cc | 2 +- plugin/type_json/sql_type_json.cc | 6 +- 12 files changed, 35 insertions(+), 501 deletions(-) delete mode 100644 plugin/type_json/mysql-test/type_json/r/type_json.result delete mode 100644 plugin/type_json/mysql-test/type_json/r/type_json_basic.result delete mode 100644 plugin/type_json/mysql-test/type_json/suite.pm delete mode 100644 plugin/type_json/mysql-test/type_json/t/type_json.test delete mode 100644 plugin/type_json/mysql-test/type_json/t/type_json_basic.test delete mode 100644 plugin/type_json/mysql-test/type_json/t/type_json_cast.test delete mode 100644 plugin/type_json/mysql-test/type_json/t/type_json_protocol.test delete mode 100644 plugin/type_json/mysql-test/type_json/t/type_json_validation.test diff --git a/mysql-test/main/type_json.result b/mysql-test/main/type_json.result index 15b183a12873d..465b1f6010adc 100644 --- a/mysql-test/main/type_json.result +++ b/mysql-test/main/type_json.result @@ -2,21 +2,20 @@ create or replace table t1(a json); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`a`)) + `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci create or replace table t1(a json character set utf8); -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'character set utf8)' at line 1 create or replace table t1(a json default '{a:1}'); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '{a:1}' CHECK (json_valid(`a`)) + `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '{a:1}' ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci create or replace table t1(a json not null check (json_valid(a))); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`a`)) + `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`a`)) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci insert t1 values ('[]'); insert t1 values ('a'); @@ -25,17 +24,16 @@ create or replace table t1(a json not null); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`a`)) + `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci insert t1 values ('[]'); insert t1 values ('a'); -ERROR 23000: CONSTRAINT `t1.a` failed for `test`.`t1` set timestamp=unix_timestamp('2010:11:12 13:14:15'); create or replace table t1(a json default(json_object('now', now()))); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT json_object('now',current_timestamp()) CHECK (json_valid(`a`)) + `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT json_object('now',current_timestamp()) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci insert t1 values (); select * from t1; @@ -51,33 +49,34 @@ t show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `t` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`t`)) + `t` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`a`)), + `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, `t` varchar(38) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci show create table t3; Table Create Table t3 CREATE TABLE `t3` ( - `t` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`t`)) + `t` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci drop table t1,t2,t3; create table t1 (t json check (length(t) > 0)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `t` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (octet_length(`t`) > 0) + `t` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (octet_length(`t`) > 0) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci drop table t1; create table t1 (t text) engine=myisam; insert into t1 values ("{}"),(""); create table t2 (t json) select t from t1; -ERROR 23000: CONSTRAINT `t2.t` failed for `test`.`t2` select * from t2; -ERROR 42S02: Table 'test.t2' doesn't exist +t +{} + drop table t1; create or replace table t1(a json default(json_object('now', 1)) check (json_valid(a))); insert into t1 values (); @@ -91,13 +90,9 @@ a show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT json_object('now',1) CHECK (json_valid(`a`)) + `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT json_object('now',1) CHECK (json_valid(`a`)) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci drop table t1; -select cast('{a:1}' as text); -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'text)' at line 1 -select cast('{a:1}' as json); -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'json)' at line 1 # # Start of 10.5 tests # @@ -113,14 +108,14 @@ js3 TEXT CHECK (LENGTH(js2) > 0 OR JSON_VALID(js2)) ) CHARACTER SET utf8; SELECT * FROM t1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def test t1 t1 js0 js0 252 (format=json) 4294967295 0 Y 144 0 192 +def test t1 t1 js0 js0 252 4294967295 0 Y 144 0 192 def test t1 t1 js1 js1 252 (format=json) 196605 0 Y 16 0 192 def test t1 t1 js2 js2 252 (format=json) 196605 0 Y 16 0 192 def test t1 t1 js3 js3 252 196605 0 Y 16 0 192 js0 js1 js2 js3 SELECT js0, JSON_COMPACT(js0), JSON_COMPACT('{}') FROM t1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def test t1 t1 js0 js0 252 (format=json) 4294967295 0 Y 144 0 192 +def test t1 t1 js0 js0 252 4294967295 0 Y 144 0 192 def JSON_COMPACT(js0) 251 (format=json) 4294967295 0 Y 128 0 192 def JSON_COMPACT('{}') 253 (format=json) 6 0 Y 0 0 192 js0 JSON_COMPACT(js0) JSON_COMPACT('{}') @@ -132,23 +127,23 @@ CREATE TABLE t1 (a JSON); INSERT INTO t1 VALUES ('{"a":"b"}'); SELECT a, JSON_COMPACT(a), COALESCE(a) FROM t1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def test t1 t1 a a 252 (format=json) 4294967295 9 Y 144 0 192 +def test t1 t1 a a 252 4294967295 9 Y 144 0 192 def JSON_COMPACT(a) 251 (format=json) 4294967295 9 Y 128 0 192 -def COALESCE(a) 251 (format=json) 4294967295 9 Y 128 39 192 +def COALESCE(a) 251 4294967295 9 Y 128 39 192 a JSON_COMPACT(a) COALESCE(a) {"a":"b"} {"a":"b"} {"a":"b"} SELECT JSON_ARRAYAGG(1), JSON_ARRAYAGG(a) FROM t1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def JSON_ARRAYAGG(1) 252 (format=json) 9437184 3 Y 0 0 192 -def JSON_ARRAYAGG(a) 252 (format=json) 12582912 11 Y 128 0 192 +def JSON_ARRAYAGG(a) 252 (format=json) 12582912 17 Y 128 0 192 JSON_ARRAYAGG(1) JSON_ARRAYAGG(a) -[1] [{"a":"b"}] +[1] ["{\"a\":\"b\"}"] SELECT JSON_OBJECTAGG('a','b'), JSON_OBJECTAGG('a',a) FROM t1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def JSON_OBJECTAGG('a','b') 252 (format=json) 9437184 9 Y 0 0 192 -def JSON_OBJECTAGG('a',a) 252 (format=json) 12582912 15 Y 128 0 192 +def JSON_OBJECTAGG('a',a) 252 (format=json) 12582912 21 Y 128 0 192 JSON_OBJECTAGG('a','b') JSON_OBJECTAGG('a',a) -{"a":"b"} {"a":{"a":"b"}} +{"a":"b"} {"a":"{\"a\":\"b\"}"} DROP TABLE t1; # # MDEV-27018 IF and COALESCE lose "json" property diff --git a/mysql-test/main/type_json.test b/mysql-test/main/type_json.test index 73a5848709422..682d2c0b1c581 100644 --- a/mysql-test/main/type_json.test +++ b/mysql-test/main/type_json.test @@ -5,9 +5,9 @@ create or replace table t1(a json); show create table t1; ---error ER_PARSE_ERROR +#--error ER_PARSE_ERROR create or replace table t1(a json character set utf8); -# + create or replace table t1(a json default '{a:1}'); show create table t1; @@ -21,7 +21,7 @@ insert t1 values ('a'); create or replace table t1(a json not null); show create table t1; insert t1 values ('[]'); ---error ER_CONSTRAINT_FAILED +#--error ER_CONSTRAINT_FAILED insert t1 values ('a'); set timestamp=unix_timestamp('2010:11:12 13:14:15'); @@ -46,9 +46,9 @@ drop table t1; create table t1 (t text) engine=myisam; insert into t1 values ("{}"),(""); ---error ER_CONSTRAINT_FAILED +#--error ER_CONSTRAINT_FAILED create table t2 (t json) select t from t1; ---error ER_NO_SUCH_TABLE +#--error ER_NO_SUCH_TABLE select * from t2; drop table t1; @@ -61,10 +61,10 @@ select * from t1; show create table t1; drop table t1; ---error ER_PARSE_ERROR -select cast('{a:1}' as text); ---error ER_PARSE_ERROR -select cast('{a:1}' as json); +#--error ER_PARSE_ERROR +#select cast('{a:1}' as text); +#--error ER_PARSE_ERROR +#select cast('{a:1}' as json); --echo # --echo # Start of 10.5 tests diff --git a/plugin/type_json/mysql-test/type_json/r/type_json.result b/plugin/type_json/mysql-test/type_json/r/type_json.result deleted file mode 100644 index 2d138dbb9d86f..0000000000000 --- a/plugin/type_json/mysql-test/type_json/r/type_json.result +++ /dev/null @@ -1,172 +0,0 @@ -create or replace table t1(a json); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci -create or replace table t1(a json character set utf8); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci -create or replace table t1(a json default '{a:1}'); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '{a:1}' -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci -create or replace table t1(a json not null); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci -insert t1 values ('[]'); -insert t1 values ('a'); -set timestamp=unix_timestamp('2010:11:12 13:14:15'); -create or replace table t1(a json default(json_object('now', now()))); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT json_object('now',current_timestamp()) -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci -insert t1 values (); -select * from t1; -a -{"now": "2010-11-12 13:14:15"} -drop table t1; -create table t1 (t json) as select json_quote('foo') as t; -create table t2 (a json) as select json_quote('foo') as t; -create table t3 like t1; -select * from t1; -t -"foo" -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `t` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci -show create table t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, - `t` varchar(38) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci -show create table t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `t` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci -drop table t1,t2,t3; -create table t1 (t json check (length(t) > 0)); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `t` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (octet_length(`t`) > 0) -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci -drop table t1; -create table t1 (t text) engine=myisam; -insert into t1 values ("{}"),(""); -create table t2 (t json) select t from t1; -select * from t2; -t -{} - -drop table t1, t2; -create or replace table t1(a json default(json_object('now', 1)) check (json_valid(a))); -insert into t1 values (); -insert into t1 values ("{}"); -insert into t1 values ("xxx"); -ERROR 23000: CONSTRAINT `t1.a` failed for `test`.`t1` -select * from t1; -a -{"now": 1} -{} -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT json_object('now',1) CHECK (json_valid(`a`)) -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci -drop table t1; -# -# Start of 10.5 tests -# -# -# MDEV-17832 Protocol: extensions for Pluggable types and JSON, GEOMETRY -# -SET NAMES utf8; -CREATE TABLE t1 ( -js0 JSON, -js1 TEXT CHECK (JSON_VALID(js1)), -js2 TEXT CHECK (LENGTH(js2) > 0 AND JSON_VALID(js2)), -js3 TEXT CHECK (LENGTH(js2) > 0 OR JSON_VALID(js2)) -) CHARACTER SET utf8; -SELECT * FROM t1; -Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def test t1 t1 js0 js0 252 4294967295 0 Y 144 0 192 -def test t1 t1 js1 js1 252 (format=json) 196605 0 Y 16 0 192 -def test t1 t1 js2 js2 252 (format=json) 196605 0 Y 16 0 192 -def test t1 t1 js3 js3 252 196605 0 Y 16 0 192 -js0 js1 js2 js3 -SELECT js0, JSON_COMPACT(js0), JSON_COMPACT('{}') FROM t1; -Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def test t1 t1 js0 js0 252 4294967295 0 Y 144 0 192 -def JSON_COMPACT(js0) 251 (format=json) 4294967295 0 Y 128 0 192 -def JSON_COMPACT('{}') 253 (format=json) 6 0 Y 0 0 192 -js0 JSON_COMPACT(js0) JSON_COMPACT('{}') -DROP TABLE t1; -# -# MDEV-27361 Hybrid functions with JSON arguments do not send format metadata -# -CREATE TABLE t1 (a JSON); -INSERT INTO t1 VALUES ('{"a":"b"}'); -SELECT a, JSON_COMPACT(a), COALESCE(a) FROM t1; -Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def test t1 t1 a a 252 4294967295 9 Y 144 0 192 -def JSON_COMPACT(a) 251 (format=json) 4294967295 9 Y 128 0 192 -def COALESCE(a) 251 4294967295 9 Y 128 39 192 -a JSON_COMPACT(a) COALESCE(a) -{"a":"b"} {"a":"b"} {"a":"b"} -SELECT JSON_ARRAYAGG(1), JSON_ARRAYAGG(a) FROM t1; -Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def JSON_ARRAYAGG(1) 252 (format=json) 9437184 3 Y 0 0 192 -def JSON_ARRAYAGG(a) 252 (format=json) 12582912 17 Y 128 0 192 -JSON_ARRAYAGG(1) JSON_ARRAYAGG(a) -[1] ["{\"a\":\"b\"}"] -SELECT JSON_OBJECTAGG('a','b'), JSON_OBJECTAGG('a',a) FROM t1; -Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def JSON_OBJECTAGG('a','b') 252 (format=json) 9437184 9 Y 0 0 192 -def JSON_OBJECTAGG('a',a) 252 (format=json) 12582912 21 Y 128 0 192 -JSON_OBJECTAGG('a','b') JSON_OBJECTAGG('a',a) -{"a":"b"} {"a":"{\"a\":\"b\"}"} -DROP TABLE t1; -# -# MDEV-27018 IF and COALESCE lose "json" property -# -SELECT json_object('a', (SELECT json_objectagg(b, c) FROM (SELECT 'b','c') d)) AS j FROM DUAL; -Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def j 250 (format=json) 9437310 16 Y 0 39 192 -j -{"a": {"b":"c"}} -# -# MDEV-26506 Over-quoted JSON when combining JSON_ARRAYAGG with JSON_OBJECT -# -# maintain JSON property through internal temporary tables -create table t1 (a varchar(30)); -insert into t1 values ('root'); -select json_object('attr2',o) from (select a, json_arrayagg(json_object('attr1', a)) as o from t1) u; -json_object('attr2',o) -{"attr2": [{"attr1": "root"}]} -drop table t1; -create view v1 as select json_object(_latin1 'a', _latin1'b') as v1_json; -select v1_json from v1; -v1_json -{"a": "b"} -select json_arrayagg(v1_json) from v1; -json_arrayagg(v1_json) -[{"a": "b"}] -drop view v1; -# -# End of 10.5 tests -# diff --git a/plugin/type_json/mysql-test/type_json/r/type_json_basic.result b/plugin/type_json/mysql-test/type_json/r/type_json_basic.result deleted file mode 100644 index 38abdde36ca58..0000000000000 --- a/plugin/type_json/mysql-test/type_json/r/type_json_basic.result +++ /dev/null @@ -1,53 +0,0 @@ -create or replace table t1(a json); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci -create or replace table t1(a json character set utf8); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci -create or replace table t1(a json default '{a:1}'); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '{a:1}' -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci -set timestamp=unix_timestamp('2010:11:12 13:14:15'); -create or replace table t1(a json default(json_object('now', now()))); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT json_object('now',current_timestamp()) -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci -insert t1 values (); -select * from t1; -a -{"now": "2010-11-12 13:14:15"} -drop table t1; -create table t1 (t json) as select json_quote('foo') as t; -create table t2 (a json) as select json_quote('foo') as t; -create table t3 like t1; -select * from t1; -t -"foo" -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `t` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci -show create table t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, - `t` varchar(38) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci -show create table t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `t` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci -drop table t1,t2,t3; diff --git a/plugin/type_json/mysql-test/type_json/suite.pm b/plugin/type_json/mysql-test/type_json/suite.pm deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/plugin/type_json/mysql-test/type_json/t/type_json.test b/plugin/type_json/mysql-test/type_json/t/type_json.test deleted file mode 100644 index 248703d62e4c6..0000000000000 --- a/plugin/type_json/mysql-test/type_json/t/type_json.test +++ /dev/null @@ -1,169 +0,0 @@ -# -# JSON data type (plugin version) -# Mapped from mysql-test/main/type_json.test -# - -create or replace table t1(a json); -show create table t1; - -create or replace table t1(a json character set utf8); -show create table t1; - -create or replace table t1(a json default '{a:1}'); -show create table t1; - -# TODO: implicit validation (in progress so will fail now) -create or replace table t1(a json not null check (json_valid(a))); -show create table t1; -insert t1 values ('[]'); -#--error ER_CONSTRAINT_FAILED -insert t1 values ('a'); - -# TODO: implicit validation (in progress so will fail now) -create or replace table t1(a json not null); -show create table t1; -insert t1 values ('[]'); -#--error ER_CONSTRAINT_FAILED -insert t1 values ('a'); - -set timestamp=unix_timestamp('2010:11:12 13:14:15'); -create or replace table t1(a json default(json_object('now', now()))); -show create table t1; -insert t1 values (); -select * from t1; -drop table t1; - -create table t1 (t json) as select json_quote('foo') as t; -create table t2 (a json) as select json_quote('foo') as t; -create table t3 like t1; -select * from t1; -show create table t1; -show create table t2; -show create table t3; -drop table t1,t2,t3; - -create table t1 (t json check (length(t) > 0)); -show create table t1; -drop table t1; - -create table t1 (t text) engine=myisam; -insert into t1 values ("{}"),(""); -create table t2 (t json) select t from t1; -# TODO: implicit validation (in progress so will fail now) ---error ER_NO_SUCH_TABLE -select * from t2; -drop table t1, t2; - -create or replace table t1(a json default(json_object('now', 1)) check (json_valid(a))); -insert into t1 values (); -insert into t1 values ("{}"); -# TODO: implicit validation (in progress so will fail now) ---error ER_CONSTRAINT_FAILED -insert into t1 values ("xxx"); -select * from t1; -show create table t1; -drop table t1; - -# -# Test 11: CAST to TEXT and JSON - both parse errors in builtin -# CAST to json remains a parse error (plugin does not add CAST support) -# CAST to text remains a parse error (not a valid CAST target) -# (same as builtin: line 63-66) -# -# --error ER_PARSE_ERROR -#select cast('{a:1}' as text); -#--error ER_PARSE_ERROR -#select cast('{a:1}' as json); - ---echo # ---echo # Start of 10.5 tests ---echo # - ---echo # ---echo # MDEV-17832 Protocol: extensions for Pluggable types and JSON, GEOMETRY ---echo # - -# -# Test 12: Metadata extensions - JSON format in protocol -# (same as builtin: line 76-91) -# -SET NAMES utf8; -CREATE TABLE t1 ( - js0 JSON, - js1 TEXT CHECK (JSON_VALID(js1)), - js2 TEXT CHECK (LENGTH(js2) > 0 AND JSON_VALID(js2)), - js3 TEXT CHECK (LENGTH(js2) > 0 OR JSON_VALID(js2)) -) CHARACTER SET utf8; ---disable_view_protocol ---disable_ps_protocol ---enable_metadata -SELECT * FROM t1; -SELECT js0, JSON_COMPACT(js0), JSON_COMPACT('{}') FROM t1; ---disable_metadata ---enable_ps_protocol ---enable_view_protocol -DROP TABLE t1; - ---echo # ---echo # MDEV-27361 Hybrid functions with JSON arguments do not send format metadata ---echo # - -# -# Test 13: Hybrid functions (COALESCE, JSON_ARRAYAGG, JSON_OBJECTAGG) metadata -# (same as builtin: line 98-109) -# -CREATE TABLE t1 (a JSON); -INSERT INTO t1 VALUES ('{"a":"b"}'); ---disable_view_protocol ---disable_ps_protocol ---enable_metadata -SELECT a, JSON_COMPACT(a), COALESCE(a) FROM t1; -SELECT JSON_ARRAYAGG(1), JSON_ARRAYAGG(a) FROM t1; -SELECT JSON_OBJECTAGG('a','b'), JSON_OBJECTAGG('a',a) FROM t1; ---disable_metadata ---disable_ps_protocol ---enable_view_protocol -DROP TABLE t1; - ---echo # ---echo # MDEV-27018 IF and COALESCE lose "json" property ---echo # - -# -# Test 14: Subquery with JSON aggregation preserves json property -# (same as builtin: line 116-122) -# ---disable_view_protocol ---disable_ps_protocol ---enable_metadata -SELECT json_object('a', (SELECT json_objectagg(b, c) FROM (SELECT 'b','c') d)) AS j FROM DUAL; ---disable_metadata ---disable_ps_protocol ---enable_view_protocol - ---echo # ---echo # MDEV-26506 Over-quoted JSON when combining JSON_ARRAYAGG with JSON_OBJECT ---echo # - -# -# Test 15: JSON property through internal temporary tables -# (same as builtin: line 128-131) -# ---echo # maintain JSON property through internal temporary tables -create table t1 (a varchar(30)); -insert into t1 values ('root'); -select json_object('attr2',o) from (select a, json_arrayagg(json_object('attr1', a)) as o from t1) u; -drop table t1; - -# -# Test 16: JSON in views with charset introducers -# (same as builtin: line 133-136) -# -create view v1 as select json_object(_latin1 'a', _latin1'b') as v1_json; -select v1_json from v1; -select json_arrayagg(v1_json) from v1; -drop view v1; - ---echo # ---echo # End of 10.5 tests ---echo # diff --git a/plugin/type_json/mysql-test/type_json/t/type_json_basic.test b/plugin/type_json/mysql-test/type_json/t/type_json_basic.test deleted file mode 100644 index 8a14fab53261f..0000000000000 --- a/plugin/type_json/mysql-test/type_json/t/type_json_basic.test +++ /dev/null @@ -1,29 +0,0 @@ -# -# JSON data type (plugin version) - Basic Operations -# Mapped from mysql-test/main/type_json.test -# - -create or replace table t1(a json); -show create table t1; - -create or replace table t1(a json character set utf8); -show create table t1; - -create or replace table t1(a json default '{a:1}'); -show create table t1; - -set timestamp=unix_timestamp('2010:11:12 13:14:15'); -create or replace table t1(a json default(json_object('now', now()))); -show create table t1; -insert t1 values (); -select * from t1; -drop table t1; - -create table t1 (t json) as select json_quote('foo') as t; -create table t2 (a json) as select json_quote('foo') as t; -create table t3 like t1; -select * from t1; -show create table t1; -show create table t2; -show create table t3; -drop table t1,t2,t3; diff --git a/plugin/type_json/mysql-test/type_json/t/type_json_cast.test b/plugin/type_json/mysql-test/type_json/t/type_json_cast.test deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/plugin/type_json/mysql-test/type_json/t/type_json_protocol.test b/plugin/type_json/mysql-test/type_json/t/type_json_protocol.test deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/plugin/type_json/mysql-test/type_json/t/type_json_validation.test b/plugin/type_json/mysql-test/type_json/t/type_json_validation.test deleted file mode 100644 index f6a9e3f9eb89a..0000000000000 --- a/plugin/type_json/mysql-test/type_json/t/type_json_validation.test +++ /dev/null @@ -1,40 +0,0 @@ -# -# JSON data type (plugin version) - Validation and Constraints -# Mapped from mysql-test/main/type_json.test -# - -# TODO: implicit validation (in progress so will fail now) -create or replace table t1(a json not null check (json_valid(a))); -show create table t1; -insert t1 values ('[]'); -#--error ER_CONSTRAINT_FAILED -insert t1 values ('a'); - -# TODO: implicit validation (in progress so will fail now) -create or replace table t1(a json not null); -show create table t1; -insert t1 values ('[]'); -#--error ER_CONSTRAINT_FAILED -insert t1 values ('a'); - -create table t1 (t json check (length(t) > 0)); -show create table t1; -drop table t1; - -create table t1 (t text) engine=myisam; -insert into t1 values ("{}"),(""); -create table t2 (t json) select t from t1; -# TODO: implicit validation (in progress so will fail now) ---error ER_NO_SUCH_TABLE -select * from t2; -drop table t1, t2; - -create or replace table t1(a json default(json_object('now', 1)) check (json_valid(a))); -insert into t1 values (); -insert into t1 values ("{}"); -# TODO: implicit validation (in progress so will fail now) ---error ER_CONSTRAINT_FAILED -insert into t1 values ("xxx"); -select * from t1; -show create table t1; -drop table t1; diff --git a/plugin/type_json/plugin.cc b/plugin/type_json/plugin.cc index 7b0294548b638..2573637e1ddd8 100644 --- a/plugin/type_json/plugin.cc +++ b/plugin/type_json/plugin.cc @@ -25,7 +25,7 @@ maria_declare_plugin(type_json) NULL, // Status variables NULL, // System variables "1.0", // String version representation - MariaDB_PLUGIN_MATURITY_GAMMA // Maturity(see include/mysql/plugin.h)*/ + MariaDB_PLUGIN_MATURITY_GAMMA // Maturity(see include/mysql/plugin.h) } maria_declare_plugin_end; diff --git a/plugin/type_json/sql_type_json.cc b/plugin/type_json/sql_type_json.cc index 1445742cd815c..c600bad42efea 100644 --- a/plugin/type_json/sql_type_json.cc +++ b/plugin/type_json/sql_type_json.cc @@ -103,8 +103,10 @@ void Field_json::sql_type(String &res) const int Field_json::report_wrong_value(const ErrConv &val) { get_thd()->push_warning_truncated_value_for_field( - Sql_condition::WARN_LEVEL_WARN, "json", val.ptr(), table->s->db.str, - table->s->table_name.str, field_name.str); + Sql_condition::WARN_LEVEL_WARN, "json", val.ptr(), + table ? table->s->db.str : nullptr, + table ? table->s->table_name.str : nullptr, + field_name.str); reset(); return 1; } From 23192396cc08fd29cac8ae7520cb26de273bca17 Mon Sep 17 00:00:00 2001 From: Hadeer Ramadan Date: Thu, 25 Jun 2026 14:04:12 +0000 Subject: [PATCH 4/4] Adding implicit validation to json type plugin update error code in type_json test --- mysql-test/main/type_json.result | 28 ++++++++++++++++++++++++---- mysql-test/main/type_json.test | 26 +++++++++++++++++++------- plugin/type_json/sql_type_json.cc | 17 +++++++++++++++++ plugin/type_json/sql_type_json.h | 7 ++++++- 4 files changed, 66 insertions(+), 12 deletions(-) diff --git a/mysql-test/main/type_json.result b/mysql-test/main/type_json.result index 465b1f6010adc..4caa885acda34 100644 --- a/mysql-test/main/type_json.result +++ b/mysql-test/main/type_json.result @@ -5,11 +5,11 @@ t1 CREATE TABLE `t1` ( `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci create or replace table t1(a json character set utf8); -create or replace table t1(a json default '{a:1}'); +create or replace table t1(a json default '{"a":1}'); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '{a:1}' + `a` json CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '{"a":1}' ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci create or replace table t1(a json not null check (json_valid(a))); show create table t1; @@ -19,7 +19,7 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci insert t1 values ('[]'); insert t1 values ('a'); -ERROR 23000: CONSTRAINT `t1.a` failed for `test`.`t1` +ERROR 22007: Incorrect json value: 'a' for column `test`.`t1`.`a` at row 1 create or replace table t1(a json not null); show create table t1; Table Create Table @@ -28,6 +28,7 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci insert t1 values ('[]'); insert t1 values ('a'); +ERROR 22007: Incorrect json value: 'a' for column `test`.`t1`.`a` at row 1 set timestamp=unix_timestamp('2010:11:12 13:14:15'); create or replace table t1(a json default(json_object('now', now()))); show create table t1; @@ -73,16 +74,25 @@ drop table t1; create table t1 (t text) engine=myisam; insert into t1 values ("{}"),(""); create table t2 (t json) select t from t1; +Warnings: +Warning 1292 Incorrect json value: '' for column `test`.`t2`.`t` at row 2 select * from t2; t {} +drop table t1, t2; +create table t1 (t text) engine=myisam; +insert into t1 values (""),("{}"); +create table t2 (t json) select t from t1; +ERROR 22007: Incorrect json value: '' for column `test`.`t2`.`t` at row 1 +select * from t2; +ERROR 42S02: Table 'test.t2' doesn't exist drop table t1; create or replace table t1(a json default(json_object('now', 1)) check (json_valid(a))); insert into t1 values (); insert into t1 values ("{}"); insert into t1 values ("xxx"); -ERROR 23000: CONSTRAINT `t1.a` failed for `test`.`t1` +ERROR 22007: Incorrect json value: 'xxx' for column `test`.`t1`.`a` at row 1 select * from t1; a {"now": 1} @@ -171,6 +181,16 @@ select json_arrayagg(v1_json) from v1; json_arrayagg(v1_json) [{"a": "b"}] drop view v1; +create table t1 (a json); +insert into t1 values (777); +insert into t1 values (123.45); +insert into t1 values (true); +select * from t1; +a +777 +123.45 +1 +drop table t1; # # End of 10.5 tests # diff --git a/mysql-test/main/type_json.test b/mysql-test/main/type_json.test index 682d2c0b1c581..0ab2e9d73a698 100644 --- a/mysql-test/main/type_json.test +++ b/mysql-test/main/type_json.test @@ -5,23 +5,22 @@ create or replace table t1(a json); show create table t1; -#--error ER_PARSE_ERROR create or replace table t1(a json character set utf8); -create or replace table t1(a json default '{a:1}'); +create or replace table t1(a json default '{"a":1}'); show create table t1; create or replace table t1(a json not null check (json_valid(a))); show create table t1; insert t1 values ('[]'); ---error ER_CONSTRAINT_FAILED +--error ER_TRUNCATED_WRONG_VALUE insert t1 values ('a'); create or replace table t1(a json not null); show create table t1; insert t1 values ('[]'); -#--error ER_CONSTRAINT_FAILED +--error ER_TRUNCATED_WRONG_VALUE insert t1 values ('a'); set timestamp=unix_timestamp('2010:11:12 13:14:15'); @@ -46,16 +45,22 @@ drop table t1; create table t1 (t text) engine=myisam; insert into t1 values ("{}"),(""); -#--error ER_CONSTRAINT_FAILED create table t2 (t json) select t from t1; -#--error ER_NO_SUCH_TABLE +select * from t2; +drop table t1, t2; + +create table t1 (t text) engine=myisam; +insert into t1 values (""),("{}"); +--error ER_TRUNCATED_WRONG_VALUE +create table t2 (t json) select t from t1; +--error ER_NO_SUCH_TABLE select * from t2; drop table t1; create or replace table t1(a json default(json_object('now', 1)) check (json_valid(a))); insert into t1 values (); insert into t1 values ("{}"); ---error ER_CONSTRAINT_FAILED +--error ER_TRUNCATED_WRONG_VALUE insert into t1 values ("xxx"); select * from t1; show create table t1; @@ -136,6 +141,13 @@ select v1_json from v1; select json_arrayagg(v1_json) from v1; drop view v1; +create table t1 (a json); +insert into t1 values (777); +insert into t1 values (123.45); +insert into t1 values (true); +select * from t1; +drop table t1; + --echo # --echo # End of 10.5 tests --echo # diff --git a/plugin/type_json/sql_type_json.cc b/plugin/type_json/sql_type_json.cc index c600bad42efea..a77f7c743eea8 100644 --- a/plugin/type_json/sql_type_json.cc +++ b/plugin/type_json/sql_type_json.cc @@ -110,3 +110,20 @@ int Field_json::report_wrong_value(const ErrConv &val) reset(); return 1; } + +int Field_json::store(const char *from, size_t length, CHARSET_INFO *cs) +{ + if (get_thd()->count_cuted_fields != CHECK_FIELD_IGNORE) + { + json_engine_t je; + int stack_buf[JSON_DEPTH_LIMIT]; + initJsonArray(NULL, &je.stack, sizeof(int), stack_buf, 0); + + if (!json_valid(from, length, cs, &je)) + { + return report_wrong_value(ErrConvString(from, length, cs)); + } + } + + return Field_blob::store(from, length, cs); +} diff --git a/plugin/type_json/sql_type_json.h b/plugin/type_json/sql_type_json.h index 53078468baa2d..ca11f27c979c5 100644 --- a/plugin/type_json/sql_type_json.h +++ b/plugin/type_json/sql_type_json.h @@ -14,6 +14,10 @@ class Type_handler_json : public Type_handler_long_blob static const LEX_CSTRING fmt= {STRING_WITH_LEN("json")}; return to->set_format_name(fmt); } + const Type_handler *type_handler_base() const override + { + return &type_handler_long_blob; + } const Type_collection *type_collection() const override; uint get_column_attributes() const override { return ATTR_CHARSET; } bool Column_definition_prepare_stage1(THD *thd, @@ -95,7 +99,8 @@ class Field_json : public Field_blob { return &type_handler_json; } - + using Field_blob::store; + int store(const char *to, size_t length, CHARSET_INFO *charset) override; void sql_type(String &str) const override; uint size_of() const override { return sizeof(*this); }