Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
22.08.7, 22.08.8
-
None
Description
Build tested: 22.08.8 RC
JSON_TYPE(datatype) returns "OBJE" instead of "OBJECT"
For InnoDB tables, "OBJECT" is returned.
The difference is in the last query in the following examples.
ColumnStore
MariaDB [mytest]> CREATE TABLE `jsontest` (
|
-> `cInt` int(11) DEFAULT NULL,
|
-> `cVarchar` varchar(300) DEFAULT NULL,
|
-> `cText` text DEFAULT NULL
|
-> ) ENGINE=Columnstore;
|
Query OK, 0 rows affected (0.143 sec)
|
|
MariaDB [mytest]>
|
MariaDB [mytest]> SET @json = '{"A": 1, "B": 2, "C": 3}';
|
Query OK, 0 rows affected (0.000 sec)
|
|
MariaDB [mytest]> SELECT @json;
|
+--------------------------+
|
| @json |
|
+--------------------------+
|
| {"A": 1, "B": 2, "C": 3} |
|
+--------------------------+
|
1 row in set (0.000 sec)
|
|
MariaDB [mytest]> INSERT INTO jsontest VALUES (1, @json, @json);
|
Query OK, 1 row affected (0.145 sec)
|
|
MariaDB [mytest]> #
|
MariaDB [mytest]> SELECT JSON_TYPE(@json);
|
+------------------+
|
| JSON_TYPE(@json) |
|
+------------------+
|
| OBJECT |
|
+------------------+
|
1 row in set (0.000 sec)
|
|
MariaDB [mytest]> #
|
MariaDB [mytest]> SELECT * FROM jsontest;
|
+------+--------------------------+--------------------------+
|
| cInt | cVarchar | cText |
|
+------+--------------------------+--------------------------+
|
| 1 | {"A": 1, "B": 2, "C": 3} | {"A": 1, "B": 2, "C": 3} |
|
+------+--------------------------+--------------------------+
|
1 row in set (0.033 sec)
|
|
MariaDB [mytest]> SELECT cVarchar, JSON_TYPE(cVarchar), cText, JSON_TYPE(cText) from jsontest;
|
+--------------------------+---------------------+--------------------------+------------------+
|
| cVarchar | JSON_TYPE(cVarchar) | cText | JSON_TYPE(cText) |
|
+--------------------------+---------------------+--------------------------+------------------+
|
| {"A": 1, "B": 2, "C": 3} | OBJE | {"A": 1, "B": 2, "C": 3} | OBJE |
|
+--------------------------+---------------------+--------------------------+------------------+
|
1 row in set (0.005 sec)
|
InnoDB
MariaDB [mytest]> DROP TABLE IF EXISTS jsontest;
|
Query OK, 0 rows affected (0.003 sec)
|
|
MariaDB [mytest]> CREATE TABLE `jsontest` (
|
-> `cInt` int(11) DEFAULT NULL,
|
-> `cVarchar` varchar(300) DEFAULT NULL,
|
-> `cText` text DEFAULT NULL
|
-> ) ENGINE=innodb;
|
Query OK, 0 rows affected (0.002 sec)
|
|
MariaDB [mytest]>
|
MariaDB [mytest]> SET @json = '{"A": 1, "B": 2, "C": 3}';
|
Query OK, 0 rows affected (0.000 sec)
|
|
MariaDB [mytest]> SELECT @json;
|
+--------------------------+
|
| @json |
|
+--------------------------+
|
| {"A": 1, "B": 2, "C": 3} |
|
+--------------------------+
|
1 row in set (0.000 sec)
|
|
MariaDB [mytest]> INSERT INTO jsontest VALUES (1, @json, @json);
|
Query OK, 1 row affected (0.000 sec)
|
|
MariaDB [mytest]> #
|
MariaDB [mytest]> SELECT JSON_TYPE(@json);
|
+------------------+
|
| JSON_TYPE(@json) |
|
+------------------+
|
| OBJECT |
|
+------------------+
|
1 row in set (0.000 sec)
|
|
MariaDB [mytest]> #
|
MariaDB [mytest]> SELECT * FROM jsontest;
|
+------+--------------------------+--------------------------+
|
| cInt | cVarchar | cText |
|
+------+--------------------------+--------------------------+
|
| 1 | {"A": 1, "B": 2, "C": 3} | {"A": 1, "B": 2, "C": 3} |
|
+------+--------------------------+--------------------------+
|
1 row in set (0.000 sec)
|
|
MariaDB [mytest]> SELECT cVarchar, JSON_TYPE(cVarchar), cText, JSON_TYPE(cText) from jsontest;
|
+--------------------------+---------------------+--------------------------+------------------+
|
| cVarchar | JSON_TYPE(cVarchar) | cText | JSON_TYPE(cText) |
|
+--------------------------+---------------------+--------------------------+------------------+
|
| {"A": 1, "B": 2, "C": 3} | OBJECT | {"A": 1, "B": 2, "C": 3} | OBJECT |
|
+--------------------------+---------------------+--------------------------+------------------+
|
Attachments
Issue Links
- is caused by
-
MDEV-28947 JSON_TYPE result is turncated, charset max length should be considered
- Closed