aliases with multi-table updates / deletes

fix for a bug with derived tables and query cache
ix for a charset bug in timestamp
parent 5a44f2bc
......@@ -235,7 +235,7 @@ select * from t2;
n d
1 30
1 30
UPDATE t1 a ,t2 b SET t1.d=t2.d,t2.d=30 WHERE a.n=b.n;
UPDATE t1 a ,t2 b SET a.d=b.d,b.d=30 WHERE a.n=b.n;
select * from t1;
n d
1 30
......
......@@ -531,6 +531,7 @@ i
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 2
update t1 set i=(select distinct 1 from (select * from t2) a);
drop table t1, t2, t3;
use mysql;
select * from db;
......
......@@ -213,7 +213,7 @@ insert into t2 values(1,10),(1,20);
UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n;
select * from t1;
select * from t2;
UPDATE t1 a ,t2 b SET t1.d=t2.d,t2.d=30 WHERE a.n=b.n;
UPDATE t1 a ,t2 b SET a.d=b.d,b.d=30 WHERE a.n=b.n;
select * from t1;
select * from t2;
DELETE t1, t2 FROM t1 a,t2 b where a.n=b.n;
......
......@@ -21,3 +21,8 @@
#select * into dumpfile "/tmp/select-test.99" from t1;
#select load_file("/tmp/select-test.not-exist");
#drop table t1;
#drop table if exists t;
#CREATE TABLE t ( t timestamp NOT NULL, c char(200) character set latin1 NOT NULL default '', KEY t (t)) TYPE=MyISAM;
#INSERT INTO t VALUES ('2002-12-20 12:01:20','');
#select * from t into outfile "fdg";
#drop table if exists t;
......@@ -368,6 +368,7 @@ select * from t2;
show status like "Qcache_queries_in_cache";
select * from t3;
show status like "Qcache_queries_in_cache";
update t1 set i=(select distinct 1 from (select * from t2) a);
drop table t1, t2, t3;
#
......
......@@ -2845,6 +2845,7 @@ String *Field_timestamp::val_str(String *val_buffer,
val_buffer->alloc(field_length+1);
char *to=(char*) val_buffer->ptr(),*end=to+field_length;
val_buffer->length(field_length);
val_buffer->set_charset(val_ptr->charset());
#ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first)
......
......@@ -3003,7 +3003,7 @@ mysql_init_query(THD *thd)
lex->select_lex.link_prev= (st_select_lex_node**)&(lex->all_selects_list);
lex->olap=lex->describe=0;
lex->derived_tables= false;
lex->lock_option=TL_UNLOCK;
lex->lock_option=TL_READ;
thd->check_loops_counter= thd->select_number=
lex->select_lex.select_number= 1;
thd->free_list= 0;
......
......@@ -2522,7 +2522,7 @@ join_table:
lex->current_select= unit->outer_select();
if (!($$= lex->current_select->
add_table_to_list(lex->thd, new Table_ident(unit), $5, 0,
lex->lock_option,(List<String> *)0,
TL_READ,(List<String> *)0,
(List<String> *)0)))
YYABORT;
......
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