| 1 |
set default_storage_engine=innodb; |
| 2 |
# Verify that the client can show JSON data and metadata. |
| 3 |
CREATE TABLE t(i INT, j1 JSON, j2 JSON NOT NULL) CHARSET utf8mb4; |
| 4 |
SHOW CREATE TABLE t; |
| 5 |
Table Create Table |
| 6 |
t CREATE TABLE `t` ( |
| 7 |
`i` int DEFAULT NULL, |
| 8 |
`j1` json DEFAULT NULL, |
| 9 |
`j2` json NOT NULL |
| 10 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
| 11 |
INSERT INTO t VALUES |
| 12 |
(0, NULL, 'null'), |
| 13 |
(1, '1', '1'), |
| 14 |
(2, '[1,2,3]', '[4,5,6]'), |
| 15 |
(3, '{"abc":"def"}', '{"a":"b","c":"d"}'); |
| 16 |
-------------- |
| 17 |
SELECT j1, j2 FROM t ORDER BY i |
| 18 |
-------------- |
| 19 |
|
| 20 |
Field 1: `j1` |
| 21 |
Catalog: `def` |
| 22 |
Database: `test` |
| 23 |
Table: `t` |
| 24 |
Org_table: `t` |
| 25 |
Type: JSON |
| 26 |
Collation: binary (63) |
| 27 |
Length: 4294967295 |
| 28 |
Max_length: 14 |
| 29 |
Decimals: 0 |
| 30 |
Flags: BLOB BINARY |
| 31 |
|
| 32 |
Field 2: `j2` |
| 33 |
Catalog: `def` |
| 34 |
Database: `test` |
| 35 |
Table: `t` |
| 36 |
Org_table: `t` |
| 37 |
Type: JSON |
| 38 |
Collation: binary (63) |
| 39 |
Length: 4294967295 |
| 40 |
Max_length: 20 |
| 41 |
Decimals: 0 |
| 42 |
Flags: NOT_NULL BLOB BINARY NO_DEFAULT_VALUE |
| 43 |
|
| 44 |
|
| 45 |
+----------------+----------------------+ |
| 46 |
| j1 | j2 | |
| 47 |
+----------------+----------------------+ |
| 48 |
| NULL | null | |
| 49 |
| 1 | 1 | |
| 50 |
| [1, 2, 3] | [4, 5, 6] | |
| 51 |
| {"abc": "def"} | {"a": "b", "c": "d"} | |
| 52 |
+----------------+----------------------+ |
| 53 |
4 rows in set <FILTERED> |
| 54 |
|
| 55 |
Bye |
| 56 |
DROP TABLE t; |