diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:07:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:07:14 +0000 |
commit | a175314c3e5827eb193872241446f2f8f5c9d33c (patch) | |
tree | cd3d60ca99ae00829c52a6ca79150a5b6e62528b /mysql-test/main/func_default.test | |
parent | Initial commit. (diff) | |
download | mariadb-10.5-a175314c3e5827eb193872241446f2f8f5c9d33c.tar.xz mariadb-10.5-a175314c3e5827eb193872241446f2f8f5c9d33c.zip |
Adding upstream version 1:10.5.12.upstream/1%10.5.12upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/main/func_default.test')
-rw-r--r-- | mysql-test/main/func_default.test | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/mysql-test/main/func_default.test b/mysql-test/main/func_default.test new file mode 100644 index 00000000..332bfca0 --- /dev/null +++ b/mysql-test/main/func_default.test @@ -0,0 +1,48 @@ +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + + +create table t1(str varchar(10) default 'def',strnull varchar(10),intg int default '10',rel double default '3.14'); + +insert into t1 values ('','',0,0.0); +select default(str), default(strnull), default(intg), default(rel) from t1; +explain extended select default(str), default(strnull), default(intg), default(rel) from t1; +select * from t1 where str <> default(str); +explain select * from t1 where str <> default(str); + +create view v1 as select default(str), default(strnull), default(intg), default(rel) from t1; +select * from v1; +show create view v1; +drop view v1; + +#TODO: uncomment when bug will be fixed +#create table t2 select default(str), default(strnull), default(intg), default(rel) from t1; +#show create table from t1; +#insert into t2 select select default(str), default(strnull), default(intg), default(rel) from t1; + +drop table t1; + +# End of 4.1 tests + +# +# Bug #11314 (HAVING DEFAULT() hangs) +# +CREATE TABLE t1 (id int(11), s varchar(20)); +INSERT INTO t1 VALUES (1, 'one'), (2, 'two'), (3, 'three'); +--error 1364 +SELECT s, 32 AS mi FROM t1 GROUP BY s HAVING DEFAULT(mi) IS NULL; +DROP TABLE t1; + +# +# 10.2 tests +# + +set timestamp=unix_timestamp('2001-01-01 10:20:30.123456'); +create table t1 (a int default 1, b int default (a+1), + c varchar(100) default 'foo', d text default 'bar', + e timestamp default now(), f timestamp(6) default now(2)); +insert t1 () values (); +insert t1 (a) values (10); +select default(a),default(b),default(c),default(d),default(e),default(f) from t1; +drop table t1; |