summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2017-05-20 16:29:11 +0400
committerAlexander Barkov <bar@mariadb.org>2017-05-20 16:29:11 +0400
commita8caa8e04a27f7463abd4fd588a4ce1799e600c7 (patch)
treeeed0aa6dbbe164a32d79e47d4be52c09ec55c1df /mysql-test/t
parentd2fec340d25c24c8862f461b1f3272c098e67d54 (diff)
downloadmariadb-git-a8caa8e04a27f7463abd4fd588a4ce1799e600c7.tar.gz
MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/func_json.test23
-rw-r--r--mysql-test/t/func_misc.test16
-rw-r--r--mysql-test/t/gis.test19
-rw-r--r--mysql-test/t/metadata.test74
4 files changed, 132 insertions, 0 deletions
diff --git a/mysql-test/t/func_json.test b/mysql-test/t/func_json.test
index 0fc8e97b284..ee7e51241d4 100644
--- a/mysql-test/t/func_json.test
+++ b/mysql-test/t/func_json.test
@@ -296,3 +296,26 @@ INSERT INTO t1 VALUES (0);
SELECT JSON_KEYS(f) FROM t1 ORDER BY 1;
DROP TABLE t1;
+--echo #
+--echo # Start of 10.3 tests
+--echo #
+
+--echo #
+--echo # MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
+--echo #
+
+--enable_metadata
+--disable_ps_protocol
+
+SELECT
+ JSON_VALID('{"id": 1, "name": "Monty"}') AS json_valid,
+ JSON_EXISTS('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2") AS json_exists,
+ JSON_CONTAINS('{"A": 0, "B": {"C": 1}, "D": 2}', '2', '$.A') AS ison_contains,
+ JSON_CONTAINS_PATH('{"A": 1, "B": [2], "C": [3, 4]}', 'one', '$.A', '$.D') AS json_contains_path;
+
+SELECT
+ JSON_LENGTH('{"a": 1, "b": {"c": 30}}') AS json_length,
+ JSON_DEPTH('[10, {"a": 20}]') AS json_depnth;
+
+--enable_ps_protocol
+--disable_metadata
diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test
index f931352c0e2..c661819424a 100644
--- a/mysql-test/t/func_misc.test
+++ b/mysql-test/t/func_misc.test
@@ -1127,3 +1127,19 @@ DROP TABLE t1;
--echo #
--echo # End of 10.2 tests
--echo #
+
+--echo #
+--echo # Start of 10.3 tests
+--echo #
+
+--echo #
+--echo # MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
+--echo #
+
+--enable_metadata
+--disable_ps_protocol
+
+SELECT INET_ATON("255.255.255.255.255.255.255.255");
+
+--enable_ps_protocol
+--disable_metadata
diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test
index ab9c792d523..b38e68fe5e7 100644
--- a/mysql-test/t/gis.test
+++ b/mysql-test/t/gis.test
@@ -2307,5 +2307,24 @@ DROP TABLE t1;
--echo #
+--echo # MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
+--echo #
+
+--enable_metadata
+--disable_ps_protocol
+SELECT
+ ST_ISSIMPLE(POINT(1,1)),
+ ST_ISRING(POINT(1,1)),
+ ST_ISCLOSED(POINT(1,1)),
+ ST_DIMENSION(POINT(1,1)),
+ ST_NUMGEOMETRIES(POINT(1,1)),
+ ST_NUMINTERIORRINGS(POINT(1,1)),
+ ST_NUMPOINTS(POINT(1,1)),
+ ST_SRID(POINT(1,1));
+--enable_ps_protocol
+--disable_metadata
+
+
+--echo #
--echo # End of 10.3 tests
--echo #
diff --git a/mysql-test/t/metadata.test b/mysql-test/t/metadata.test
index 60c7470cb67..0bd1b98c07d 100644
--- a/mysql-test/t/metadata.test
+++ b/mysql-test/t/metadata.test
@@ -252,3 +252,77 @@ drop table t1;
--enable_metadata
select cast('01:01:01' as time), cast('01:01:01' as time(2));
--disable_metadata
+
+
+--echo #
+--echo # MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
+--echo #
+
+--enable_metadata
+SELECT
+ STRCMP('a','b'),
+ OCTET_LENGTH('a'),
+ CHAR_LENGTH('a'),
+ COERCIBILITY('a'),
+ ASCII('a'),
+ ORD('a'),
+ CRC32('a'),
+ UNCOMPRESSED_LENGTH(COMPRESS('a'));
+
+SELECT
+ INTERVAL(2,1,2,3),
+ REGEXP_INSTR('a','a'),
+ LOCATE('a','a'),
+ FIND_IN_SET('b','a,b,c,d'),
+ FIELD('a','a','b');
+
+SELECT
+ SIGN(1),
+ BIT_COUNT(1);
+
+
+SELECT
+ BENCHMARK(0,0),
+ SLEEP(0);
+
+SELECT
+ GET_LOCK('metadata',0),
+ IS_FREE_LOCK('metadata'),
+ RELEASE_LOCK('metadata');
+
+# Metadata the following functions is not deterministic
+#SELECT CONNECTION_ID();
+#SELECT IS_FREE_LOCK('metadata');
+#SELECT UUID_SHORT();
+
+
+SELECT
+ PERIOD_ADD(200801,2),
+ PERIOD_DIFF(200802,200703),
+ TO_DAYS('2007-10-07'),
+ DAYOFMONTH('2007-02-03'),
+ DAYOFWEEK('2007-02-03'),
+ TO_SECONDS('2013-06-13');
+
+SELECT
+ YEAR('2001-02-03 04:05:06.000007'),
+ DAY('2001-02-03 04:05:06.000007'),
+ HOUR('2001-02-03 04:05:06.000007'),
+ MINUTE('2001-02-03 04:05:06.000007'),
+ SECOND('2001-02-03 04:05:06.000007'),
+ MICROSECOND('2001-02-03 04:05:06.000007');
+
+SELECT
+ WEEK('2001-02-03 04:05:06.000007'),
+ QUARTER('2001-02-03 04:05:06.000007'),
+ YEARWEEK('2001-02-03 04:05:06.000007');
+
+--disable_metadata
+
+--enable_metadata
+SELECT BIT_LENGTH(10);
+SELECT 1|2, 1&2, 1<<2, 1>>2, ~0, 1^2;
+SELECT LAST_INSERT_ID();
+SELECT ROW_COUNT(), FOUND_ROWS();
+SELECT TIMESTAMPDIFF(MONTH,'2003-02-01','2003-05-01');
+--disable_metadata