Commit 38cf7770 authored by unknown's avatar unknown

Merge bk@192.168.21.1:/usr/home/bk/mysql-5.0

into deer.(none):/home/hf/work/mysql-5.0.clean

parents 2de78782 02b1eb98
......@@ -16,3 +16,8 @@ explain select * from t1 where str <> default(str);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
drop table t1;
CREATE TABLE t1 (id int(11), s varchar(20));
INSERT INTO t1 VALUES (1, 'one'), (2, 'two'), (3, 'three');
SELECT s, 32 AS mi FROM t1 GROUP BY s HAVING DEFAULT(mi) IS NULL;
ERROR HY000: Field 'mi' doesn't have a default value
DROP TABLE t1;
......@@ -16,4 +16,14 @@ explain select * from t1 where str <> default(str);
#show create table from t1;
#insert into t2 select select default(str), default(strnull), default(intg), default(rel) from t1;
drop table t1;
\ No newline at end of file
drop table t1;
#
# 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;
......@@ -4454,16 +4454,14 @@ bool Item_default_value::fix_fields(THD *thd,
}
if (!arg->fixed && arg->fix_fields(thd, table_list, &arg))
return TRUE;
if (arg->type() == REF_ITEM)
arg= arg->real_item();
if (arg->type() != FIELD_ITEM)
{
Item_ref *ref= (Item_ref *)arg;
if (ref->ref[0]->type() != FIELD_ITEM)
{
return TRUE;
}
arg= ref->ref[0];
my_error(ER_NO_DEFAULT_FOR_FIELD, MYF(0), arg->name);
return TRUE;
}
field_arg= (Item_field *)arg;
if (field_arg->field->flags & NO_DEFAULT_VALUE_FLAG)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment