summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSinisa@sinisa.nasamreza.org <>2002-12-28 21:34:17 +0200
committerSinisa@sinisa.nasamreza.org <>2002-12-28 21:34:17 +0200
commit1e2bec80097d6e2b9ebb0b69d7f7b68a0448fece (patch)
tree5297180578ae74db613ac34609d154992d7192eb
parent5a44f2bc26b4dbb22e1c1f9a6e20dba8563814fc (diff)
downloadmariadb-git-1e2bec80097d6e2b9ebb0b69d7f7b68a0448fece.tar.gz
aliases with multi-table updates / deletes
fix for a bug with derived tables and query cache ix for a charset bug in timestamp
-rw-r--r--mysql-test/r/multi_update.result2
-rw-r--r--mysql-test/r/query_cache.result1
-rw-r--r--mysql-test/t/multi_update.test2
-rw-r--r--mysql-test/t/outfile.test5
-rw-r--r--mysql-test/t/query_cache.test1
-rw-r--r--sql/field.cc1
-rw-r--r--sql/sql_parse.cc2
-rw-r--r--sql/sql_yacc.yy2
8 files changed, 12 insertions, 4 deletions
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
index f19323e1ffe..dd2afc67e26 100644
--- a/mysql-test/r/multi_update.result
+++ b/mysql-test/r/multi_update.result
@@ -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
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index a37313a150a..ad9294e6d3a 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -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;
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test
index 4e0622d14bb..28780ab4ed0 100644
--- a/mysql-test/t/multi_update.test
+++ b/mysql-test/t/multi_update.test
@@ -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;
diff --git a/mysql-test/t/outfile.test b/mysql-test/t/outfile.test
index c126d221bd2..3d524cb35a2 100644
--- a/mysql-test/t/outfile.test
+++ b/mysql-test/t/outfile.test
@@ -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;
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
index 6c3f3d6ac52..eeaf1a83d1a 100644
--- a/mysql-test/t/query_cache.test
+++ b/mysql-test/t/query_cache.test
@@ -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;
#
diff --git a/sql/field.cc b/sql/field.cc
index 9acf2e14829..00739f1ed14 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -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)
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 95a739014e5..6d57ee21f3a 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -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;
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 53fa8afe4a7..d64d69b7c2f 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -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;