func_default.test 1006 Bytes
Newer Older
unknown's avatar
unknown committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
--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);

#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;

19 20 21 22 23
drop table t1;

#
# Bug #11314 (HAVING DEFAULT() hangs)
#
24
CREATE TABLE t1 (id int(11), s varchar(20));
25
INSERT INTO t1 VALUES (1, 'one'), (2, 'two'), (3, 'three');
26
--error 1364
27 28 29
SELECT s, 32 AS mi FROM t1 GROUP BY s HAVING DEFAULT(mi) IS NULL;
DROP TABLE t1;