summaryrefslogtreecommitdiff
path: root/mysql-test/t/type_json.test
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-07-03 16:22:30 +0200
committerSergei Golubchik <serg@mariadb.org>2017-07-05 17:15:59 +0200
commit1ea3c93fda52d2c154811e19853cff89342006a6 (patch)
tree7a91ad983a877b55ff113891d106157fb2bac99b /mysql-test/t/type_json.test
parent51d457f371ddf2191f48ec197e8f7364cfa071c8 (diff)
downloadmariadb-git-1ea3c93fda52d2c154811e19853cff89342006a6.tar.gz
MDEV-9144 JSON data type
for compatibility with MySQL, add 'JSON' as an alias for 'TEXT'
Diffstat (limited to 'mysql-test/t/type_json.test')
-rw-r--r--mysql-test/t/type_json.test28
1 files changed, 28 insertions, 0 deletions
diff --git a/mysql-test/t/type_json.test b/mysql-test/t/type_json.test
new file mode 100644
index 00000000000..0f6d091d6e3
--- /dev/null
+++ b/mysql-test/t/type_json.test
@@ -0,0 +1,28 @@
+#
+# MDEV-9144 JSON data type
+#
+
+create or replace table t1(a json);
+show create table t1;
+
+create or replace table t1(a json character set utf8 default '{a:1}');
+show create table t1;
+
+create or replace table t1(a json binary not null check (json_valid(a)));
+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;
+
+--error ER_PARSE_ERROR
+select cast('{a:1}' as text);
+--error ER_PARSE_ERROR
+select cast('{a:1}' as json);