Commit 84a9a9fe authored by unknown's avatar unknown

aliases with multi-table updates / deletes

fix for a bug with derived tables and query cache
ix for a charset bug in timestamp


mysql-test/r/multi_update.result:
  aliases with multi-table updates / deletes
mysql-test/r/query_cache.result:
  fix for query cache with derived tables
mysql-test/t/multi_update.test:
  aliases with multi-table updates / deletes
mysql-test/t/outfile.test:
  Fix of bug with charset in timestamp
mysql-test/t/query_cache.test:
  fix for a bug with derived tables and query cache
sql/field.cc:
  fix for a charset bug in timestamp
sql/sql_parse.cc:
  aliases with multi-table updates / deletes
sql/sql_yacc.yy:
  aliases with multi-table updates / deletes
parent dcf6470f
...@@ -235,7 +235,7 @@ select * from t2; ...@@ -235,7 +235,7 @@ select * from t2;
n d n d
1 30 1 30
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; select * from t1;
n d n d
1 30 1 30
......
...@@ -531,6 +531,7 @@ i ...@@ -531,6 +531,7 @@ i
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
Variable_name Value Variable_name Value
Qcache_queries_in_cache 2 Qcache_queries_in_cache 2
update t1 set i=(select distinct 1 from (select * from t2) a);
drop table t1, t2, t3; drop table t1, t2, t3;
use mysql; use mysql;
select * from db; select * from db;
......
...@@ -213,7 +213,7 @@ insert into t2 values(1,10),(1,20); ...@@ -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; UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n;
select * from t1; select * from t1;
select * from t2; 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 t1;
select * from t2; select * from t2;
DELETE t1, t2 FROM t1 a,t2 b where a.n=b.n; DELETE t1, t2 FROM t1 a,t2 b where a.n=b.n;
......
...@@ -21,3 +21,8 @@ ...@@ -21,3 +21,8 @@
#select * into dumpfile "/tmp/select-test.99" from t1; #select * into dumpfile "/tmp/select-test.99" from t1;
#select load_file("/tmp/select-test.not-exist"); #select load_file("/tmp/select-test.not-exist");
#drop table t1; #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; ...@@ -368,6 +368,7 @@ select * from t2;
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
select * from t3; select * from t3;
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
update t1 set i=(select distinct 1 from (select * from t2) a);
drop table t1, t2, t3; drop table t1, t2, t3;
# #
......
...@@ -2845,6 +2845,7 @@ String *Field_timestamp::val_str(String *val_buffer, ...@@ -2845,6 +2845,7 @@ String *Field_timestamp::val_str(String *val_buffer,
val_buffer->alloc(field_length+1); val_buffer->alloc(field_length+1);
char *to=(char*) val_buffer->ptr(),*end=to+field_length; char *to=(char*) val_buffer->ptr(),*end=to+field_length;
val_buffer->length(field_length); val_buffer->length(field_length);
val_buffer->set_charset(val_ptr->charset());
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->db_low_byte_first)
......
...@@ -3003,7 +3003,7 @@ mysql_init_query(THD *thd) ...@@ -3003,7 +3003,7 @@ mysql_init_query(THD *thd)
lex->select_lex.link_prev= (st_select_lex_node**)&(lex->all_selects_list); lex->select_lex.link_prev= (st_select_lex_node**)&(lex->all_selects_list);
lex->olap=lex->describe=0; lex->olap=lex->describe=0;
lex->derived_tables= false; lex->derived_tables= false;
lex->lock_option=TL_UNLOCK; lex->lock_option=TL_READ;
thd->check_loops_counter= thd->select_number= thd->check_loops_counter= thd->select_number=
lex->select_lex.select_number= 1; lex->select_lex.select_number= 1;
thd->free_list= 0; thd->free_list= 0;
......
...@@ -2522,7 +2522,7 @@ join_table: ...@@ -2522,7 +2522,7 @@ join_table:
lex->current_select= unit->outer_select(); lex->current_select= unit->outer_select();
if (!($$= lex->current_select-> if (!($$= lex->current_select->
add_table_to_list(lex->thd, new Table_ident(unit), $5, 0, 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))) (List<String> *)0)))
YYABORT; 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