Commit 1fbe1fc3 authored by unknown's avatar unknown

Merge mysql.com:/home/hf/work/mysql-5.0-0mrg

into  mysql.com:/home/hf/work/mysql-5.1-mrg


client/mysqltest.c:
  Auto merged
include/my_time.h:
  Auto merged
include/mysql.h:
  Auto merged
libmysql/libmysql.c:
  Auto merged
libmysqld/lib_sql.cc:
  Auto merged
mysql-test/r/gis-rtree.result:
  Auto merged
mysql-test/r/order_by.result:
  Auto merged
mysql-test/include/deadlock.inc:
  Auto merged
mysql-test/r/query_cache.result:
  Auto merged
mysql-test/r/subselect.result:
  Auto merged
mysql-test/r/type_newdecimal.result:
  Auto merged
mysql-test/t/flush.test:
  Auto merged
mysql-test/t/flush_block_commit.test:
  Auto merged
mysql-test/t/innodb-lock.test:
  Auto merged
mysql-test/t/lock_multi.test:
  Auto merged
mysql-test/t/mysql.test:
  Auto merged
mysql-test/t/query_cache.test:
  Auto merged
mysql-test/t/rename.test:
  Auto merged
mysql-test/t/show_check.test:
  Auto merged
mysql-test/t/status.test:
  Auto merged
mysql-test/t/subselect.test:
  Auto merged
sql/field.cc:
  Auto merged
sql/field.h:
  Auto merged
sql/handler.cc:
  Auto merged
sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/item_subselect.cc:
  Auto merged
sql/item_subselect.h:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/item_sum.h:
  Auto merged
sql/item_timefunc.cc:
  Auto merged
sql/item_timefunc.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/protocol.cc:
  Auto merged
sql/protocol.h:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql-common/client.c:
  Auto merged
sql-common/my_time.c:
  Auto merged
sql/table.cc:
  Auto merged
Makefile.am:
  SCCS merged
mysql-test/t/order_by.test:
  SCCS merged
mysql-test/t/type_newdecimal.test:
  merging
parents 8b0e79f2 3ebdcee5
......@@ -475,7 +475,6 @@ void handle_error(struct st_command*,
const char *err_sqlstate, DYNAMIC_STRING *ds);
void handle_no_error(struct st_command*);
#ifdef EMBEDDED_LIBRARY
/*
send_one_query executes query in separate thread what is
......
......@@ -96,3 +96,37 @@ i
2
affected rows: 1
affected rows: 0
create table t1 (id int(10));
insert into t1 values (1);
CREATE VIEW v1 AS select t1.id as id from t1;
CREATE VIEW v2 AS select t1.id as renamed from t1;
CREATE VIEW v3 AS select t1.id + 12 as renamed from t1;
select * from v1 group by id limit 1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 v1 id id 3 10 1 Y 32768 0 63
id
1
select * from v1 group by id limit 0;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 v1 id id 3 10 0 Y 32768 0 63
id
select * from v1 where id=1000 group by id;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 v1 id id 3 10 0 Y 32768 0 63
id
select * from v1 where id=1 group by id;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 v1 id id 3 10 1 Y 32768 0 63
id
1
select * from v2 where renamed=1 group by renamed;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 v2 id renamed 3 10 1 Y 32768 0 63
renamed
1
select * from v3 where renamed=1 group by renamed;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def v3 renamed 8 12 0 Y 32896 0 63
renamed
drop table t1;
drop view v1,v2,v3;
......@@ -760,13 +760,6 @@ xxxxxxxxxxxxxxxxxxxaa
xxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxz
drop table t1;
create table t1 (a int not null, b int not null, c int not null);
insert t1 values (1,1,1),(1,1,2),(1,2,1);
select a, b from t1 group by a, b order by sum(c);
a b
1 2
1 1
drop table t1;
create table t1 (
`sid` decimal(8,0) default null,
`wnid` varchar(11) not null default '',
......@@ -881,6 +874,13 @@ num (select num + 2 FROM t1 LIMIT 1)
SELECT a.a + 1 AS num FROM t1 a JOIN t1 b ON num = b.a;
ERROR 42S22: Unknown column 'num' in 'on clause'
DROP TABLE t1;
create table t1 (a int not null, b int not null, c int not null);
insert t1 values (1,1,1),(1,1,2),(1,2,1);
select a, b from t1 group by a, b order by sum(c);
a b
1 2
1 1
drop table t1;
CREATE TABLE t1 (a int, b int, PRIMARY KEY (a));
INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
explain SELECT t1.b as a, t2.b as c FROM
......
......@@ -1276,3 +1276,51 @@ Variable_name Value
Last_query_cost 0.000000
drop table t1;
SET GLOBAL query_cache_size=0;
set global query_cache_size=1024*1024;
flush status;
create table t1 (a int);
insert into t1 (a) values (1), (2), (3);
select * from t1;
a
1
2
3
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 0
select * from t1;
a
1
2
3
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 1
create table t2 like t1;
select * from t1;
a
1
2
3
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 2
insert into t2 select * from t1;
select * from t1;
a
1
2
3
show status like 'Qcache_hits';
Variable_name Value
Qcache_hits 3
drop table t1, t2;
create table t1(c1 int);
create table t2(c1 int);
create table t3(c1 int);
create view v1 as select t3.c1 as c1 from t3,t2 where t3.c1 = t2.c1;
start transaction;
insert into t1(c1) select c1 from v1;
drop table t1, t2, t3;
drop view v1;
set global query_cache_size=0;
......@@ -61,4 +61,23 @@ drop table t1;//
delimiter ;//
--disable_info
#
# Bug #20191: getTableName gives wrong or inconsistent result when using VIEWs
#
--enable_metadata
create table t1 (id int(10));
insert into t1 values (1);
CREATE VIEW v1 AS select t1.id as id from t1;
CREATE VIEW v2 AS select t1.id as renamed from t1;
CREATE VIEW v3 AS select t1.id + 12 as renamed from t1;
select * from v1 group by id limit 1;
select * from v1 group by id limit 0;
select * from v1 where id=1000 group by id;
select * from v1 where id=1 group by id;
select * from v2 where renamed=1 group by renamed;
select * from v3 where renamed=1 group by renamed;
drop table t1;
drop view v1,v2,v3;
--disable_metadata
# End of 4.1 tests
......@@ -142,6 +142,24 @@ drop table t1;
--exec $MYSQL -e 'help ' > $MYSQLTEST_VARDIR/tmp/bug20328_2.result
--exec diff $MYSQLTEST_VARDIR/tmp/bug20328_1.result $MYSQLTEST_VARDIR/tmp/bug20328_2.result
#
# Bug #19216: Client crashes on long SELECT
#
--exec echo "select" > $MYSQLTEST_VARDIR/tmp/b19216.tmp
# 3400 * 20 makes 68000 columns that is more than the max number that can fit
# in a 16 bit number.
let $i= 3400;
while ($i)
{
--exec echo "'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a'," >> $MYSQLTEST_VARDIR/tmp/b19216.tmp
dec $i;
}
--exec echo "'b';" >> $MYSQLTEST_VARDIR/tmp/b19216.tmp
--disable_query_log
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/b19216.tmp >/dev/null
--enable_query_log
#
# Bug #20103: Escaping with backslash does not work
#
......
......@@ -514,11 +514,6 @@ set max_sort_length=20;
select a from t1 order by a;
drop table t1;
create table t1 (a int not null, b int not null, c int not null);
insert t1 values (1,1,1),(1,1,2),(1,2,1);
select a, b from t1 group by a, b order by sum(c);
drop table t1;
#
# Bug #7331
#
......@@ -594,6 +589,10 @@ SELECT a.a + 1 AS num FROM t1 a JOIN t1 b ON num = b.a;
DROP TABLE t1;
# End of 4.1 tests
create table t1 (a int not null, b int not null, c int not null);
insert t1 values (1,1,1),(1,1,2),(1,2,1);
select a, b from t1 group by a, b order by sum(c);
drop table t1;
#
# Bug#21302: Result not properly sorted when using an ORDER BY on a second
......
......@@ -877,3 +877,32 @@ select * from t1 where a > 3;
show status like 'last_query_cost';
drop table t1;
SET GLOBAL query_cache_size=0;
#
# Bug #20045: Server crash on INSERT ... SELECT ... FROM non-mergeable view
#
set global query_cache_size=1024*1024;
flush status;
create table t1 (a int);
insert into t1 (a) values (1), (2), (3);
select * from t1;
show status like 'Qcache_hits';
select * from t1;
show status like 'Qcache_hits';
create table t2 like t1;
select * from t1;
show status like 'Qcache_hits';
insert into t2 select * from t1;
select * from t1;
show status like 'Qcache_hits';
drop table t1, t2;
create table t1(c1 int);
create table t2(c1 int);
create table t3(c1 int);
create view v1 as select t3.c1 as c1 from t3,t2 where t3.c1 = t2.c1;
start transaction;
insert into t1(c1) select c1 from v1;
drop table t1, t2, t3;
drop view v1;
set global query_cache_size=0;
......@@ -4288,6 +4288,10 @@ void Item_field::make_field(Send_field *tmp_field)
DBUG_ASSERT(tmp_field->table_name != 0);
if (name)
tmp_field->col_name=name; // Use user supplied name
if (table_name)
tmp_field->table_name= table_name;
if (db_name)
tmp_field->db_name= db_name;
}
......
......@@ -3475,8 +3475,12 @@ mysql_execute_command(THD *thd)
if (first_table->lock_type == TL_WRITE_CONCURRENT_INSERT &&
thd->lock)
{
/* INSERT ... SELECT should invalidate only the very first table */
TABLE_LIST *save_table= first_table->next_local;
first_table->next_local= 0;
mysql_unlock_tables(thd, thd->lock);
query_cache_invalidate3(thd, first_table, 1);
first_table->next_local= save_table;
thd->lock=0;
}
delete result;
......
......@@ -13833,9 +13833,16 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
if (real_pos->type() == Item::FIELD_ITEM)
{
Item_field *item;
pos= real_pos;
if (!(item= new Item_field(thd, ((Item_field*) pos))))
if (!(item= new Item_field(thd, ((Item_field*) real_pos))))
goto err;
if (pos->type() == Item::REF_ITEM)
{
/* preserve the names of the ref when dereferncing */
Item_ref *ref= (Item_ref *) pos;
item->db_name= ref->db_name;
item->table_name= ref->table_name;
item->name= ref->name;
}
pos= item;
if (item->field->flags & BLOB_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