Commit 806294c5 authored by monty@mashka.mysql.fi's avatar monty@mashka.mysql.fi

Fixes after merge with 4.0

parent dac6498f
...@@ -66,14 +66,14 @@ a ...@@ -66,14 +66,14 @@ a
alter table t1 type=myisam; alter table t1 type=myisam;
explain select * from t1 where a in (869751,736494,226312,802616); explain select * from t1 where a in (869751,736494,226312,802616);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range uniq_id uniq_id 4 NULL 4 where used; Using index 1 SIMPLE t1 range uniq_id uniq_id 4 NULL 4 Using where; Using index
drop table t1; drop table t1;
create table t1 (x int not null, y int not null, key x using BTREE (x,y), unique y using BTREE (y)) create table t1 (x int not null, y int not null, key x using BTREE (x,y), unique y using BTREE (y))
type=heap; type=heap;
insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6); insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6);
explain select * from t1 where x=1; explain select * from t1 where x=1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref x x 4 const 1 where used 1 SIMPLE t1 ref x x 4 const 1 Using where
select * from t1 where x=1; select * from t1 where x=1;
x y x y
1 1 1 1
...@@ -124,17 +124,17 @@ a b ...@@ -124,17 +124,17 @@ a b
1 6 1 6
explain select * from tx where a=x order by a,b; explain select * from tx where a=x order by a,b;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
x SIMPLE tx ref a a x const x where used x SIMPLE tx ref a a x const x Using where
explain select * from tx where a=x order by b; explain select * from tx where a=x order by b;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
x SIMPLE tx ref a a x const x where used x SIMPLE tx ref a a x const x Using where
select * from t1 where b=1; select * from t1 where b=1;
a b a b
1 1 1 1
1 1 1 1
explain select * from tx where b=x; explain select * from tx where b=x;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
x SIMPLE tx ref b b x const x where used x SIMPLE tx ref b b x const x Using where
drop table t1; drop table t1;
create table t1 (id int unsigned not null, primary key using BTREE (id)) type=HEAP; create table t1 (id int unsigned not null, primary key using BTREE (id)) type=HEAP;
insert into t1 values(1); insert into t1 values(1);
...@@ -175,17 +175,17 @@ create table t1 (btn char(10) not null, key using BTREE (btn)) type=heap; ...@@ -175,17 +175,17 @@ create table t1 (btn char(10) not null, key using BTREE (btn)) type=heap;
insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i"); insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
explain select * from t1 where btn like "q%"; explain select * from t1 where btn like "q%";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL btn NULL NULL NULL 14 where used 1 SIMPLE t1 ALL btn NULL NULL NULL 14 Using where
select * from t1 where btn like "q%"; select * from t1 where btn like "q%";
btn btn
alter table t1 add column new_col char(1) not null, add key using BTREE (btn,new_col), drop key btn; alter table t1 add column new_col char(1) not null, add key using BTREE (btn,new_col), drop key btn;
update t1 set new_col=btn; update t1 set new_col=btn;
explain select * from t1 where btn="a"; explain select * from t1 where btn="a";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref btn btn 10 const 1 where used 1 SIMPLE t1 ref btn btn 10 const 1 Using where
explain select * from t1 where btn="a" and new_col="a"; explain select * from t1 where btn="a" and new_col="a";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref btn btn 11 const,const 1 where used 1 SIMPLE t1 ref btn btn 11 const,const 1 Using where
drop table t1; drop table t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
a int default NULL, a int default NULL,
...@@ -198,7 +198,7 @@ SELECT * FROM t1 WHERE a=NULL; ...@@ -198,7 +198,7 @@ SELECT * FROM t1 WHERE a=NULL;
a b a b
explain SELECT * FROM t1 WHERE a IS NULL; explain SELECT * FROM t1 WHERE a IS NULL;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 5 const 1 where used 1 SIMPLE t1 ref a a 5 const 1 Using where
SELECT * FROM t1 WHERE a<=>NULL; SELECT * FROM t1 WHERE a<=>NULL;
a b a b
NULL 99 NULL 99
...@@ -206,7 +206,7 @@ SELECT * FROM t1 WHERE b=NULL; ...@@ -206,7 +206,7 @@ SELECT * FROM t1 WHERE b=NULL;
a b a b
explain SELECT * FROM t1 WHERE b IS NULL; explain SELECT * FROM t1 WHERE b IS NULL;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref b b 5 const 1 where used 1 SIMPLE t1 ref b b 5 const 1 Using where
SELECT * FROM t1 WHERE b<=>NULL; SELECT * FROM t1 WHERE b<=>NULL;
a b a b
99 NULL 99 NULL
......
...@@ -66,7 +66,7 @@ a ...@@ -66,7 +66,7 @@ a
alter table t1 type=myisam; alter table t1 type=myisam;
explain select * from t1 where a in (869751,736494,226312,802616); explain select * from t1 where a in (869751,736494,226312,802616);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range uniq_id uniq_id 4 NULL 4 where used; Using index 1 SIMPLE t1 range uniq_id uniq_id 4 NULL 4 Using where; Using index
drop table t1; drop table t1;
create table t1 (x int not null, y int not null, key x using HASH (x), unique y using HASH (y)) create table t1 (x int not null, y int not null, key x using HASH (x), unique y using HASH (y))
type=heap; type=heap;
...@@ -159,17 +159,17 @@ create table t1 (btn char(10) not null, key using HASH (btn)) type=heap; ...@@ -159,17 +159,17 @@ create table t1 (btn char(10) not null, key using HASH (btn)) type=heap;
insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i"); insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
explain select * from t1 where btn like "q%"; explain select * from t1 where btn like "q%";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL btn NULL NULL NULL 14 where used 1 SIMPLE t1 ALL btn NULL NULL NULL 14 Using where
select * from t1 where btn like "q%"; select * from t1 where btn like "q%";
btn btn
alter table t1 add column new_col char(1) not null, add key using HASH (btn,new_col), drop key btn; alter table t1 add column new_col char(1) not null, add key using HASH (btn,new_col), drop key btn;
update t1 set new_col=btn; update t1 set new_col=btn;
explain select * from t1 where btn="a"; explain select * from t1 where btn="a";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL btn NULL NULL NULL 14 where used 1 SIMPLE t1 ALL btn NULL NULL NULL 14 Using where
explain select * from t1 where btn="a" and new_col="a"; explain select * from t1 where btn="a" and new_col="a";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref btn btn 11 const,const 10 where used 1 SIMPLE t1 ref btn btn 11 const,const 10 Using where
drop table t1; drop table t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
a int default NULL, a int default NULL,
...@@ -182,7 +182,7 @@ SELECT * FROM t1 WHERE a=NULL; ...@@ -182,7 +182,7 @@ SELECT * FROM t1 WHERE a=NULL;
a b a b
explain SELECT * FROM t1 WHERE a IS NULL; explain SELECT * FROM t1 WHERE a IS NULL;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 5 const 10 where used 1 SIMPLE t1 ref a a 5 const 10 Using where
SELECT * FROM t1 WHERE a<=>NULL; SELECT * FROM t1 WHERE a<=>NULL;
a b a b
NULL 99 NULL 99
...@@ -190,7 +190,7 @@ SELECT * FROM t1 WHERE b=NULL; ...@@ -190,7 +190,7 @@ SELECT * FROM t1 WHERE b=NULL;
a b a b
explain SELECT * FROM t1 WHERE b IS NULL; explain SELECT * FROM t1 WHERE b IS NULL;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref b b 5 const 1 where used 1 SIMPLE t1 ref b b 5 const 1 Using where
SELECT * FROM t1 WHERE b<=>NULL; SELECT * FROM t1 WHERE b<=>NULL;
a b a b
99 NULL 99 NULL
......
...@@ -35,10 +35,10 @@ insert into t1 select NULL,message from t2; ...@@ -35,10 +35,10 @@ insert into t1 select NULL,message from t2;
create table t3 (a int not null, b char(20), key(a)) type=MERGE UNION=(test.t1,test.t2); create table t3 (a int not null, b char(20), key(a)) type=MERGE UNION=(test.t1,test.t2);
explain select * from t3 where a < 10; explain select * from t3 where a < 10;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 range a a 4 NULL 10 Using where 1 SIMPLE t3 range a a 4 NULL 18 Using where
explain select * from t3 where a > 10 and a < 20; explain select * from t3 where a > 10 and a < 20;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 range a a 4 NULL 10 Using where 1 SIMPLE t3 range a a 4 NULL 16 Using where
select * from t3 where a = 10; select * from t3 where a = 10;
a b a b
10 Testing 10 Testing
...@@ -581,18 +581,18 @@ KEY files (fileset_id,fileset_root_id) ...@@ -581,18 +581,18 @@ KEY files (fileset_id,fileset_root_id)
) TYPE=MRG_MyISAM UNION=(t1); ) TYPE=MRG_MyISAM UNION=(t1);
EXPLAIN SELECT * FROM t2 IGNORE INDEX (files) WHERE fileset_id = 2 EXPLAIN SELECT * FROM t2 IGNORE INDEX (files) WHERE fileset_id = 2
AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1; AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1;
table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
t2 range PRIMARY PRIMARY 33 NULL 5 Using where 1 SIMPLE t2 range PRIMARY PRIMARY 33 NULL 5 Using where
EXPLAIN SELECT * FROM t2 WHERE fileset_id = 2 EXPLAIN SELECT * FROM t2 WHERE fileset_id = 2
AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1; AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1;
table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
t2 range PRIMARY,files PRIMARY 33 NULL 5 Using where 1 SIMPLE t2 range PRIMARY,files PRIMARY 33 NULL 5 Using where
EXPLAIN SELECT * FROM t1 WHERE fileset_id = 2 EXPLAIN SELECT * FROM t1 WHERE fileset_id = 2
AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1; AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1;
table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
t1 range PRIMARY,files PRIMARY 33 NULL 5 Using where 1 SIMPLE t1 range PRIMARY,files PRIMARY 33 NULL 5 Using where
EXPLAIN SELECT * FROM t2 WHERE fileset_id = 2 EXPLAIN SELECT * FROM t2 WHERE fileset_id = 2
AND file_code = '0000000115' LIMIT 1; AND file_code = '0000000115' LIMIT 1;
table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
t2 const PRIMARY,files PRIMARY 33 const,const 1 1 SIMPLE t2 const PRIMARY,files PRIMARY 33 const,const 1
DROP TABLE IF EXISTS t1, t2; DROP TABLE IF EXISTS t1, t2;
...@@ -72,7 +72,7 @@ show binlog events in 'slave-bin.000001' from 4; ...@@ -72,7 +72,7 @@ show binlog events in 'slave-bin.000001' from 4;
Log_name Pos Event_type Server_id Orig_log_pos Info Log_name Pos Event_type Server_id Orig_log_pos Info
slave-bin.000001 4 Start 2 4 Server ver: VERSION, Binlog ver: 3 slave-bin.000001 4 Start 2 4 Server ver: VERSION, Binlog ver: 3
slave-bin.000001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key) slave-bin.000001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
slave-bin.000001 172 Intvar 1 200 INSERT_ID=1 slave-bin.000001 172 Intvar 1 172 INSERT_ID=1
slave-bin.000001 200 Query 1 200 use `test`; insert into t1 values (NULL) slave-bin.000001 200 Query 1 200 use `test`; insert into t1 values (NULL)
slave-bin.000001 263 Query 1 263 use `test`; drop table t1 slave-bin.000001 263 Query 1 263 use `test`; drop table t1
slave-bin.000001 311 Query 1 311 use `test`; create table t1 (word char(20) not null) slave-bin.000001 311 Query 1 311 use `test`; create table t1 (word char(20) not null)
......
...@@ -1331,10 +1331,10 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -1331,10 +1331,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index 1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index
explain select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle'; explain select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index NULL fld3 30 NULL 1199 Using where; Using index 1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
explain select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle'; explain select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index NULL fld3 30 NULL 1199 Using where; Using index 1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
explain select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle'; explain select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index 1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index
......
...@@ -60,9 +60,9 @@ a b ...@@ -60,9 +60,9 @@ a b
explain select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1) explain select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)
union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a); union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 where used 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
2 SUBSELECT t3 ALL NULL NULL NULL NULL 3 Using filesort 2 SUBSELECT t3 ALL NULL NULL NULL NULL 3 Using filesort
3 UNION t4 ALL NULL NULL NULL NULL 3 where used; Using filesort 3 UNION t4 ALL NULL NULL NULL NULL 3 Using where; Using filesort
4 SUBSELECT t2 ALL NULL NULL NULL NULL 2 4 SUBSELECT t2 ALL NULL NULL NULL NULL 2
select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2; select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2;
(select a from t3 where a<t2.a*4 order by 1 desc limit 1) a (select a from t3 where a<t2.a*4 order by 1 desc limit 1) a
...@@ -76,8 +76,8 @@ explain select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from ...@@ -76,8 +76,8 @@ explain select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from
(select * from t2 where a>1) as tt; (select * from t2 where a>1) as tt;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived3> system NULL NULL NULL NULL 1 1 PRIMARY <derived3> system NULL NULL NULL NULL 1
3 DERIVED t2 ALL NULL NULL NULL NULL 2 where used 3 DERIVED t2 ALL NULL NULL NULL NULL 2 Using where
2 SUBSELECT t3 ALL NULL NULL NULL NULL 3 where used; Using filesort 2 SUBSELECT t3 ALL NULL NULL NULL NULL 3 Using where; Using filesort
select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1); select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1);
a a
2 2
...@@ -95,7 +95,7 @@ explain select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) ...@@ -95,7 +95,7 @@ explain select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a))
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t4 ALL NULL NULL NULL NULL 3 1 PRIMARY t4 ALL NULL NULL NULL NULL 3
2 DEPENDENT SUBSELECT t2 ALL NULL NULL NULL NULL 2 2 DEPENDENT SUBSELECT t2 ALL NULL NULL NULL NULL 2
3 DEPENDENT SUBSELECT t3 ALL NULL NULL NULL NULL 3 where used 3 DEPENDENT SUBSELECT t3 ALL NULL NULL NULL NULL 3 Using where
select * from t3 where exists (select * from t2 where t2.b=t3.a); select * from t3 where exists (select * from t2 where t2.b=t3.a);
a a
7 7
...@@ -129,8 +129,8 @@ NULL 1 ...@@ -129,8 +129,8 @@ NULL 1
explain select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; explain select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 1 PRIMARY t2 ALL NULL NULL NULL NULL 2
2 DEPENDENT SUBSELECT t1 system NULL NULL NULL NULL 1 where used 2 DEPENDENT SUBSELECT t1 system NULL NULL NULL NULL 1 Using where
3 DEPENDENT UNION t5 ALL NULL NULL NULL NULL 2 where used 3 DEPENDENT UNION t5 ALL NULL NULL NULL NULL 2 Using where
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2; select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
Subselect returns more than 1 record Subselect returns more than 1 record
create table attend (patient_uq int, clinic_uq int, index i1 (clinic_uq)); create table attend (patient_uq int, clinic_uq int, index i1 (clinic_uq));
...@@ -200,11 +200,11 @@ INSERT INTO searchconthardwarefr3 (topic,date,pseudo) VALUES ...@@ -200,11 +200,11 @@ INSERT INTO searchconthardwarefr3 (topic,date,pseudo) VALUES
('43506','2002-10-02','joce'),('40143','2002-08-03','joce'); ('43506','2002-10-02','joce'),('40143','2002-08-03','joce');
EXPLAIN SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03'; EXPLAIN SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE searchconthardwarefr3 index NULL PRIMARY 41 NULL 2 where used; Using index 1 SIMPLE searchconthardwarefr3 index NULL PRIMARY 41 NULL 2 Using where; Using index
EXPLAIN SELECT (SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03'); EXPLAIN SELECT (SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03');
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY No tables used 1 PRIMARY No tables used
2 SUBSELECT searchconthardwarefr3 index NULL PRIMARY 41 NULL 2 where used; Using index 2 SUBSELECT searchconthardwarefr3 index NULL PRIMARY 41 NULL 2 Using where; Using index
SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03'; SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03';
date date
2002-08-03 2002-08-03
......
...@@ -213,10 +213,10 @@ public: ...@@ -213,10 +213,10 @@ public:
longlong val_int(); longlong val_int();
String *val_str(String *str); String *val_str(String *str);
enum Item_result result_type () const { return cached_result_type; } enum Item_result result_type () const { return cached_result_type; }
bool fix_fields(THD *thd,struct st_table_list *tlist) bool fix_fields(THD *thd,struct st_table_list *tlist, Item **ref)
{ {
args[0]->top_level_item(); args[0]->top_level_item();
return Item_func::fix_fields(thd,tlist); return Item_func::fix_fields(thd, tlist, ref);
} }
void fix_length_and_dec(); void fix_length_and_dec();
const char *func_name() const { return "if"; } const char *func_name() const { return "if"; }
......
...@@ -1159,9 +1159,10 @@ int Load_log_event::write_data_body(IO_CACHE* file) ...@@ -1159,9 +1159,10 @@ int Load_log_event::write_data_body(IO_CACHE* file)
Load_log_event::Load_log_event(THD *thd_arg, sql_exchange *ex, Load_log_event::Load_log_event(THD *thd_arg, sql_exchange *ex,
const char *db_arg, const char *table_name_arg, const char *db_arg, const char *table_name_arg,
List<Item> &fields_arg, List<Item> &fields_arg,
enum enum_duplicates handle_dup) enum enum_duplicates handle_dup,
:Log_event(thd_arg),thread_id(thd_arg->thread_id), num_fields(0),fields(0), bool using_trans)
field_lens(0),field_block_len(0), :Log_event(thd_arg, 0, using_trans), thread_id(thd_arg->thread_id),
num_fields(0), fields(0), field_lens(0),field_block_len(0),
table_name(table_name_arg ? table_name_arg : ""), table_name(table_name_arg ? table_name_arg : ""),
db(db_arg), fname(ex->file_name) db(db_arg), fname(ex->file_name)
{ {
......
...@@ -541,7 +541,6 @@ bool add_field_to_list(char *field_name, enum enum_field_types type, ...@@ -541,7 +541,6 @@ bool add_field_to_list(char *field_name, enum enum_field_types type,
char *change, TYPELIB *interval,CHARSET_INFO *cs); char *change, TYPELIB *interval,CHARSET_INFO *cs);
void store_position_for_column(const char *name); void store_position_for_column(const char *name);
bool add_to_list(SQL_LIST &list,Item *group,bool asc=0); bool add_to_list(SQL_LIST &list,Item *group,bool asc=0);
void set_lock_for_tables(thr_lock_type lock_type);
void add_join_on(TABLE_LIST *b,Item *expr); void add_join_on(TABLE_LIST *b,Item *expr);
void add_join_natural(TABLE_LIST *a,TABLE_LIST *b); void add_join_natural(TABLE_LIST *a,TABLE_LIST *b);
bool add_proc_to_list(Item *item); bool add_proc_to_list(Item *item);
......
...@@ -1359,10 +1359,10 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo, ...@@ -1359,10 +1359,10 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
case SSL_TYPE_NOT_SPECIFIED: case SSL_TYPE_NOT_SPECIFIED:
break; break;
case SSL_TYPE_NONE: case SSL_TYPE_NONE:
table->field[24]->store("",0); table->field[24]->store("", 0, system_charset_info);
table->field[25]->store("",0); table->field[25]->store("", 0, system_charset_info);
table->field[26]->store("",0); table->field[26]->store("", 0, system_charset_info);
table->field[27]->store("",0); table->field[27]->store("", 0, system_charset_info);
break; break;
} }
......
...@@ -214,11 +214,11 @@ void THD::init(void) ...@@ -214,11 +214,11 @@ void THD::init(void)
void THD::change_user(void) void THD::change_user(void)
{ {
cleanup(); cleanup();
cleanup_done=0; cleanup_done= 0;
init(); init();
hash_init(&user_vars, USER_VARS_HASH_SIZE, 0, 0, hash_init(&user_vars, system_charset_info, USER_VARS_HASH_SIZE, 0, 0,
(hash_get_key) get_var_key, (hash_get_key) get_var_key,
(hash_free_key) free_user_var,0); (hash_free_key) free_user_var, 0);
} }
......
...@@ -282,7 +282,7 @@ int mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info) ...@@ -282,7 +282,7 @@ int mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
mysql_update_log.write(thd,thd->query, thd->query_length); mysql_update_log.write(thd,thd->query, thd->query_length);
if (mysql_bin_log.is_open()) if (mysql_bin_log.is_open())
{ {
Query_log_event qinfo(thd, thd->query, thd->query_length); Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
mysql_bin_log.write(&qinfo); mysql_bin_log.write(&qinfo);
} }
send_ok(thd, result); send_ok(thd, result);
......
...@@ -35,7 +35,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order, ...@@ -35,7 +35,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
SQL_SELECT *select=0; SQL_SELECT *select=0;
READ_RECORD info; READ_RECORD info;
bool using_limit=limit != HA_POS_ERROR; bool using_limit=limit != HA_POS_ERROR;
bool using_transactions, log_delayed, safe_update, const_cond; bool transactional_table, log_delayed, safe_update, const_cond;
ha_rows deleted; ha_rows deleted;
DBUG_ENTER("mysql_delete"); DBUG_ENTER("mysql_delete");
......
...@@ -1180,7 +1180,6 @@ bool st_select_lex_unit::create_total_list_n_last_return(THD *thd, st_lex *lex, ...@@ -1180,7 +1180,6 @@ bool st_select_lex_unit::create_total_list_n_last_return(THD *thd, st_lex *lex,
if (!cursor) if (!cursor)
{ {
/* Add not used table to the total table list */ /* Add not used table to the total table list */
aux->lock_type= lex->lock_option;
if (!(cursor= (TABLE_LIST *) thd->memdup((char*) aux, if (!(cursor= (TABLE_LIST *) thd->memdup((char*) aux,
sizeof(*aux)))) sizeof(*aux))))
{ {
......
...@@ -239,7 +239,7 @@ public: ...@@ -239,7 +239,7 @@ public:
thr_lock_type flags= TL_UNLOCK, thr_lock_type flags= TL_UNLOCK,
List<String> *use_index= 0, List<String> *use_index= 0,
List<String> *ignore_index= 0); List<String> *ignore_index= 0);
virtual void set_lock_for_tables(thr_lock_type lock_type) {}
void mark_as_dependent(st_select_lex *last); void mark_as_dependent(st_select_lex *last);
private: private:
void fast_exclude(); void fast_exclude();
...@@ -364,6 +364,7 @@ public: ...@@ -364,6 +364,7 @@ public:
thr_lock_type flags= TL_UNLOCK, thr_lock_type flags= TL_UNLOCK,
List<String> *use_index= 0, List<String> *use_index= 0,
List<String> *ignore_index= 0); List<String> *ignore_index= 0);
void set_lock_for_tables(thr_lock_type lock_type);
inline void init_order() inline void init_order()
{ {
order_list.elements= 0; order_list.elements= 0;
......
...@@ -3409,7 +3409,8 @@ TABLE_LIST *st_select_lex::add_table_to_list(Table_ident *table, ...@@ -3409,7 +3409,8 @@ TABLE_LIST *st_select_lex::add_table_to_list(Table_ident *table,
DBUG_RETURN(0); // End of memory DBUG_RETURN(0); // End of memory
alias_str= alias ? alias->str : table->table.str; alias_str= alias ? alias->str : table->table.str;
if (table->table.length > NAME_LEN || if (table->table.length > NAME_LEN ||
(table->table.length && check_table_name(table->table.str,table->table.length)) || (table->table.length &&
check_table_name(table->table.str,table->table.length)) ||
table->db.str && check_db_name(table->db.str)) table->db.str && check_db_name(table->db.str))
{ {
net_printf(thd,ER_WRONG_TABLE_NAME,table->table.str); net_printf(thd,ER_WRONG_TABLE_NAME,table->table.str);
...@@ -3489,15 +3490,14 @@ TABLE_LIST *st_select_lex::add_table_to_list(Table_ident *table, ...@@ -3489,15 +3490,14 @@ TABLE_LIST *st_select_lex::add_table_to_list(Table_ident *table,
query query
*/ */
void set_lock_for_tables(thr_lock_type lock_type) void st_select_lex::set_lock_for_tables(thr_lock_type lock_type)
{ {
THD *thd=current_thd;
bool for_update= lock_type >= TL_READ_NO_INSERT; bool for_update= lock_type >= TL_READ_NO_INSERT;
DBUG_ENTER("set_lock_for_tables"); DBUG_ENTER("set_lock_for_tables");
DBUG_PRINT("enter", ("lock_type: %d for_update: %d", lock_type, DBUG_PRINT("enter", ("lock_type: %d for_update: %d", lock_type,
for_update)); for_update));
for (TABLE_LIST *tables= (TABLE_LIST*) thd->lex.select->table_list.first ; for (TABLE_LIST *tables= (TABLE_LIST*) table_list.first ;
tables ; tables ;
tables=tables->next) tables=tables->next)
{ {
......
...@@ -52,7 +52,8 @@ int mysql_update(THD *thd, ...@@ -52,7 +52,8 @@ int mysql_update(THD *thd,
ha_rows limit, ha_rows limit,
enum enum_duplicates handle_duplicates) enum enum_duplicates handle_duplicates)
{ {
bool using_limit=limit != HA_POS_ERROR, safe_update= thd->options & OPTION_SAFE_UPDATES; bool using_limit=limit != HA_POS_ERROR;
bool safe_update= thd->options & OPTION_SAFE_UPDATES;
bool used_key_is_modified, transactional_table, log_delayed; bool used_key_is_modified, transactional_table, log_delayed;
int error=0; int error=0;
uint save_time_stamp, used_index, want_privilege; uint save_time_stamp, used_index, want_privilege;
......
...@@ -646,7 +646,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -646,7 +646,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
table_to_table_list table_to_table opt_table_list opt_as table_to_table_list table_to_table opt_table_list opt_as
handler_rkey_function handler_read_or_scan handler_rkey_function handler_read_or_scan
single_multi table_wild_list table_wild_one opt_wild single_multi table_wild_list table_wild_one opt_wild
union opt_union union_list union_option union union_list union_option
precision opt_on_delete_item subselect_start opt_and precision opt_on_delete_item subselect_start opt_and
subselect_end select_var_list select_var_list_init help opt_len subselect_end select_var_list select_var_list_init help opt_len
END_OF_INPUT END_OF_INPUT
...@@ -2817,7 +2817,7 @@ insert: ...@@ -2817,7 +2817,7 @@ insert:
INSERT { Lex->sql_command = SQLCOM_INSERT; } insert_lock_option INSERT { Lex->sql_command = SQLCOM_INSERT; } insert_lock_option
opt_ignore insert2 opt_ignore insert2
{ {
set_lock_for_tables($3); Select->set_lock_for_tables($3);
} }
insert_field_spec insert_field_spec
; ;
...@@ -2831,7 +2831,7 @@ replace: ...@@ -2831,7 +2831,7 @@ replace:
} }
replace_lock_option insert2 replace_lock_option insert2
{ {
set_lock_for_tables($3); Select->set_lock_for_tables($3);
} }
insert_field_spec insert_field_spec
; ;
...@@ -2891,7 +2891,8 @@ insert_values: ...@@ -2891,7 +2891,8 @@ insert_values:
mysql_init_select(lex); mysql_init_select(lex);
} }
select_options select_item_list select_from select_lock_type select_options select_item_list select_from select_lock_type
opt_union {}; union {}
;
values_list: values_list:
values_list ',' no_braces values_list ',' no_braces
...@@ -2967,7 +2968,7 @@ update: ...@@ -2967,7 +2968,7 @@ update:
opt_low_priority opt_ignore join_table_list opt_low_priority opt_ignore join_table_list
SET update_list where_clause opt_order_clause delete_limit_clause SET update_list where_clause opt_order_clause delete_limit_clause
{ {
set_lock_for_tables($3); Select->set_lock_for_tables($3);
} }
; ;
...@@ -3004,7 +3005,7 @@ delete: ...@@ -3004,7 +3005,7 @@ delete:
single_multi: single_multi:
FROM table_ident FROM table_ident
{ {
if (!add_table_to_list($2, NULL, 1, Lex->lock_option)) if (!Select->add_table_to_list($2, NULL, 1, Lex->lock_option))
YYABORT; YYABORT;
} }
where_clause opt_order_clause where_clause opt_order_clause
...@@ -4239,9 +4240,10 @@ rollback: ...@@ -4239,9 +4240,10 @@ rollback:
*/ */
opt_union: union:
/* empty */ {} /* empty */ {}
| union_list; | union_list
;
union_list: union_list:
UNION_SYM union_option UNION_SYM union_option
...@@ -4267,7 +4269,8 @@ union_list: ...@@ -4267,7 +4269,8 @@ union_list:
union_opt: union_opt:
union_list {} union_list {}
| optional_order_or_limit {}; | optional_order_or_limit {}
;
optional_order_or_limit: optional_order_or_limit:
/* empty /* empty
......
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