~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
drop table if exists t1,t2;
2
create table t1(str varchar(10) default 'def',strnull varchar(10),intg int default '10',rel double default '3.14');
3
insert into t1 values ('','',0,0.0);
4
select default(str), default(strnull), default(intg), default(rel) from t1;
5
default(str)	default(strnull)	default(intg)	default(rel)
6
def	NULL	10	3.14
7
explain extended select default(str), default(strnull), default(intg), default(rel) from t1;
8
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
512 by Brian Aker
Adding back more test cases.
9
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	1	100.00	
1 by brian
clean slate
10
Warnings:
512 by Brian Aker
Adding back more test cases.
11
Note	1003	select default(`test`.`t1`.`str`) AS `default(str)`,default(`test`.`t1`.`strnull`) AS `default(strnull)`,default(`test`.`t1`.`intg`) AS `default(intg)`,default(`test`.`t1`.`rel`) AS `default(rel)` from `test`.`t1`
1 by brian
clean slate
12
select * from t1 where str <> default(str);
13
str	strnull	intg	rel
14
		0	0
15
explain select * from t1 where str <> default(str);
16
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
512 by Brian Aker
Adding back more test cases.
17
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	1	Using where
1 by brian
clean slate
18
drop table t1;
512 by Brian Aker
Adding back more test cases.
19
CREATE TABLE t1 (id int, s varchar(20));
1 by brian
clean slate
20
INSERT INTO t1 VALUES (1, 'one'), (2, 'two'), (3, 'three');
21
SELECT s, 32 AS mi FROM t1 GROUP BY s HAVING DEFAULT(mi) IS NULL;
22
ERROR HY000: Field 'mi' doesn't have a default value
23
DROP TABLE t1;