mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 18:41:56 +01:00
Merge mysql.com:/home/hf/work/mysql-5.0-0mrg
into mysql.com:/home/hf/work/mysql-5.1-mrg
This commit is contained in:
commit
989117071a
11 changed files with 176 additions and 15 deletions
|
@ -475,7 +475,6 @@ void handle_error(struct st_command*,
|
||||||
const char *err_sqlstate, DYNAMIC_STRING *ds);
|
const char *err_sqlstate, DYNAMIC_STRING *ds);
|
||||||
void handle_no_error(struct st_command*);
|
void handle_no_error(struct st_command*);
|
||||||
|
|
||||||
|
|
||||||
#ifdef EMBEDDED_LIBRARY
|
#ifdef EMBEDDED_LIBRARY
|
||||||
/*
|
/*
|
||||||
send_one_query executes query in separate thread what is
|
send_one_query executes query in separate thread what is
|
||||||
|
|
|
@ -96,3 +96,37 @@ i
|
||||||
2
|
2
|
||||||
affected rows: 1
|
affected rows: 1
|
||||||
affected rows: 0
|
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
|
xxxxxxxxxxxxxxxxxxxx
|
||||||
xxxxxxxxxxxxxxxxxxxz
|
xxxxxxxxxxxxxxxxxxxz
|
||||||
drop table t1;
|
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 (
|
create table t1 (
|
||||||
`sid` decimal(8,0) default null,
|
`sid` decimal(8,0) default null,
|
||||||
`wnid` varchar(11) not null default '',
|
`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;
|
SELECT a.a + 1 AS num FROM t1 a JOIN t1 b ON num = b.a;
|
||||||
ERROR 42S22: Unknown column 'num' in 'on clause'
|
ERROR 42S22: Unknown column 'num' in 'on clause'
|
||||||
DROP TABLE t1;
|
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));
|
CREATE TABLE t1 (a int, b int, PRIMARY KEY (a));
|
||||||
INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
|
INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
|
||||||
explain SELECT t1.b as a, t2.b as c FROM
|
explain SELECT t1.b as a, t2.b as c FROM
|
||||||
|
|
|
@ -1276,3 +1276,51 @@ Variable_name Value
|
||||||
Last_query_cost 0.000000
|
Last_query_cost 0.000000
|
||||||
drop table t1;
|
drop table t1;
|
||||||
SET GLOBAL query_cache_size=0;
|
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 ;//
|
delimiter ;//
|
||||||
--disable_info
|
--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
|
# End of 4.1 tests
|
||||||
|
|
|
@ -142,6 +142,24 @@ drop table t1;
|
||||||
--exec $MYSQL -e 'help ' > $MYSQLTEST_VARDIR/tmp/bug20328_2.result
|
--exec $MYSQL -e 'help ' > $MYSQLTEST_VARDIR/tmp/bug20328_2.result
|
||||||
--exec diff $MYSQLTEST_VARDIR/tmp/bug20328_1.result $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
|
# Bug #20103: Escaping with backslash does not work
|
||||||
#
|
#
|
||||||
|
|
|
@ -514,11 +514,6 @@ set max_sort_length=20;
|
||||||
select a from t1 order by a;
|
select a from t1 order by a;
|
||||||
drop table t1;
|
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
|
# 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;
|
DROP TABLE t1;
|
||||||
|
|
||||||
# End of 4.1 tests
|
# 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
|
# 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';
|
show status like 'last_query_cost';
|
||||||
drop table t1;
|
drop table t1;
|
||||||
SET GLOBAL query_cache_size=0;
|
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);
|
DBUG_ASSERT(tmp_field->table_name != 0);
|
||||||
if (name)
|
if (name)
|
||||||
tmp_field->col_name=name; // Use user supplied 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 @@ end_with_restore_list:
|
||||||
if (first_table->lock_type == TL_WRITE_CONCURRENT_INSERT &&
|
if (first_table->lock_type == TL_WRITE_CONCURRENT_INSERT &&
|
||||||
thd->lock)
|
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);
|
mysql_unlock_tables(thd, thd->lock);
|
||||||
query_cache_invalidate3(thd, first_table, 1);
|
query_cache_invalidate3(thd, first_table, 1);
|
||||||
|
first_table->next_local= save_table;
|
||||||
thd->lock=0;
|
thd->lock=0;
|
||||||
}
|
}
|
||||||
delete result;
|
delete result;
|
||||||
|
|
|
@ -13833,9 +13833,16 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
|
||||||
if (real_pos->type() == Item::FIELD_ITEM)
|
if (real_pos->type() == Item::FIELD_ITEM)
|
||||||
{
|
{
|
||||||
Item_field *item;
|
Item_field *item;
|
||||||
pos= real_pos;
|
if (!(item= new Item_field(thd, ((Item_field*) real_pos))))
|
||||||
if (!(item= new Item_field(thd, ((Item_field*) pos))))
|
|
||||||
goto err;
|
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;
|
pos= item;
|
||||||
if (item->field->flags & BLOB_FLAG)
|
if (item->field->flags & BLOB_FLAG)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue