summaryrefslogtreecommitdiff
path: root/mysql-test/t/default.test
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2016-06-09 16:29:06 +0400
committerSergei Golubchik <serg@mariadb.org>2016-06-30 11:43:02 +0200
commit582ee3973e1004f12be1921e7ef466fb062bf424 (patch)
treecb091bf2edb1d548ff61b658b6d2b0f2677d0c86 /mysql-test/t/default.test
parentf9fb646b16901ccc6078c626bc0d8c9de2ba1dd6 (diff)
downloadmariadb-git-582ee3973e1004f12be1921e7ef466fb062bf424.tar.gz
More tests for MDEV-10134 Add full support for DEFAULT
Numeric functions with string input
Diffstat (limited to 'mysql-test/t/default.test')
-rw-r--r--mysql-test/t/default.test24
1 files changed, 24 insertions, 0 deletions
diff --git a/mysql-test/t/default.test b/mysql-test/t/default.test
index ec56fc190b9..7350fafabf3 100644
--- a/mysql-test/t/default.test
+++ b/mysql-test/t/default.test
@@ -1489,3 +1489,27 @@ CREATE TABLE t1 (a VARCHAR(10), b INT DEFAULT a NOT BETWEEN 'aaa' AND 'bbb');
INSERT INTO t1 (a) VALUES ('AAA'),('aaa'),('bbb'),('ccc');
SELECT * FROM t1;
DROP TABLE t1;
+
+--echo #
+--echo # Numeric result functions with string input
+--echo #
+
+CREATE TABLE t1 (a VARCHAR(10), b INT DEFAULT STRCMP(a,'b'));
+INSERT INTO t1 (a) VALUES ('A'),('a'),('B'),('b'),('C'),('c');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a VARCHAR(10), b INT DEFAULT LENGTH(a), c INT DEFAULT CHAR_LENGTH(a), d INT DEFAULT BIT_LENGTH(a));
+INSERT INTO t1 (a) VALUES ('a'),('aa'),('aaa');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a VARCHAR(10), b INT DEFAULT LOCATE('a',a));
+INSERT INTO t1 (a) VALUES ('xa'),('xxa'),('xxxa');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a VARCHAR(10), b INT DEFAULT REGEXP_INSTR(a, 'a'));
+INSERT INTO t1 (a) VALUES ('xa'),('xxa'),('xxxa');
+SELECT * FROM t1;
+DROP TABLE t1;