mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
many bug fixes
This commit is contained in:
@ -64,7 +64,13 @@ a t
|
|||||||
18 18
|
18 18
|
||||||
19 19
|
19 19
|
||||||
20 20
|
20 20
|
||||||
|
explain select count(*) from t1 as tt1, (select * from t1) as tt2;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE Select tables optimized away
|
||||||
drop table if exists t1;
|
drop table if exists t1;
|
||||||
SELECT * FROM (SELECT (SELECT * FROM (SELECT 1 as a) as a )) as b;
|
SELECT * FROM (SELECT (SELECT * FROM (SELECT 1 as a) as a )) as b;
|
||||||
(SELECT * FROM (SELECT 1 as a) as a )
|
(SELECT * FROM (SELECT 1 as a) as a )
|
||||||
1
|
1
|
||||||
|
select * from (select 1 as a) b left join (select 2 as a) c using(a);
|
||||||
|
a a
|
||||||
|
1 NULL
|
||||||
|
@ -17,14 +17,14 @@ SELECT (SELECT 1),MAX(1) FROM (SELECT 1) as a;
|
|||||||
1 1
|
1 1
|
||||||
SELECT (SELECT a) as a;
|
SELECT (SELECT a) as a;
|
||||||
Reference 'a' not supported (forward reference in item list)
|
Reference 'a' not supported (forward reference in item list)
|
||||||
EXPLAIN SELECT 1,a FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
|
EXPLAIN SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
|
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
|
||||||
3 DEPENDENT SUBSELECT No tables used
|
3 DEPENDENT SUBSELECT No tables used
|
||||||
2 DERIVED No tables used
|
2 DERIVED No tables used
|
||||||
SELECT 1,a FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
|
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
|
||||||
1 a
|
1
|
||||||
1 1
|
1
|
||||||
SELECT (SELECT 1), a;
|
SELECT (SELECT 1), a;
|
||||||
Unknown column 'a' in 'field list'
|
Unknown column 'a' in 'field list'
|
||||||
SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1;
|
SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1;
|
||||||
@ -387,9 +387,9 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
drop table t1;
|
drop table t1;
|
||||||
CREATE TABLE t1 (a int(1));
|
CREATE TABLE t1 (a int(1));
|
||||||
INSERT INTO t1 VALUES (1);
|
INSERT INTO t1 VALUES (1);
|
||||||
SELECT 1,a FROM (SELECT a FROM t1) b HAVING (SELECT b.a)=1;
|
SELECT 1 FROM (SELECT a FROM t1) b HAVING (SELECT b.a)=1;
|
||||||
1 a
|
1
|
||||||
1 1
|
1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (a int NOT NULL, b int, primary key (a));
|
create table t1 (a int NOT NULL, b int, primary key (a));
|
||||||
create table t2 (a int NOT NULL, b int, primary key (a));
|
create table t2 (a int NOT NULL, b int, primary key (a));
|
||||||
|
@ -33,5 +33,7 @@ while ($1)
|
|||||||
}
|
}
|
||||||
enable_query_log;
|
enable_query_log;
|
||||||
SELECT * FROM (SELECT * FROM t1) as b ORDER BY a ASC LIMIT 0,20;
|
SELECT * FROM (SELECT * FROM t1) as b ORDER BY a ASC LIMIT 0,20;
|
||||||
|
explain select count(*) from t1 as tt1, (select * from t1) as tt2;
|
||||||
drop table if exists t1;
|
drop table if exists t1;
|
||||||
SELECT * FROM (SELECT (SELECT * FROM (SELECT 1 as a) as a )) as b;
|
SELECT * FROM (SELECT (SELECT * FROM (SELECT 1 as a) as a )) as b;
|
||||||
|
select * from (select 1 as a) b left join (select 2 as a) c using(a);
|
||||||
|
@ -8,8 +8,8 @@ SELECT (SELECT 1 FROM (SELECT 1) as b HAVING b=1) as a,(SELECT 1 FROM (SELECT 1)
|
|||||||
SELECT (SELECT 1),MAX(1) FROM (SELECT 1) as a;
|
SELECT (SELECT 1),MAX(1) FROM (SELECT 1) as a;
|
||||||
-- error 1245
|
-- error 1245
|
||||||
SELECT (SELECT a) as a;
|
SELECT (SELECT a) as a;
|
||||||
EXPLAIN SELECT 1,a FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
|
EXPLAIN SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
|
||||||
SELECT 1,a FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
|
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
|
||||||
-- error 1054
|
-- error 1054
|
||||||
SELECT (SELECT 1), a;
|
SELECT (SELECT 1), a;
|
||||||
SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1;
|
SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1;
|
||||||
@ -230,7 +230,7 @@ drop table t1;
|
|||||||
|
|
||||||
CREATE TABLE t1 (a int(1));
|
CREATE TABLE t1 (a int(1));
|
||||||
INSERT INTO t1 VALUES (1);
|
INSERT INTO t1 VALUES (1);
|
||||||
SELECT 1,a FROM (SELECT a FROM t1) b HAVING (SELECT b.a)=1;
|
SELECT 1 FROM (SELECT a FROM t1) b HAVING (SELECT b.a)=1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
#update with subselects
|
#update with subselects
|
||||||
|
@ -1894,13 +1894,13 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables,
|
|||||||
const char *name=item->field_name;
|
const char *name=item->field_name;
|
||||||
uint length=(uint) strlen(name);
|
uint length=(uint) strlen(name);
|
||||||
|
|
||||||
if (table_name)
|
if (table_name && table_name[0])
|
||||||
{ /* Qualified field */
|
{ /* Qualified field */
|
||||||
bool found_table=0;
|
bool found_table=0;
|
||||||
for (; tables ; tables=tables->next)
|
for (; tables ; tables=tables->next)
|
||||||
{
|
{
|
||||||
if (!strcmp(tables->alias,table_name) &&
|
if (!strcmp(tables->alias,table_name) &&
|
||||||
(!db || !strcmp(db,tables->db)))
|
(!db || !tables->db || !tables->db[0] || !strcmp(db,tables->db)))
|
||||||
{
|
{
|
||||||
found_table=1;
|
found_table=1;
|
||||||
Field *find=find_field_in_table(thd,tables->table,name,length,
|
Field *find=find_field_in_table(thd,tables->table,name,length,
|
||||||
|
@ -106,9 +106,9 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t)
|
|||||||
t->table=table;
|
t->table=table;
|
||||||
table->derived_select_number= sl->select_number;
|
table->derived_select_number= sl->select_number;
|
||||||
table->tmp_table=TMP_TABLE;
|
table->tmp_table=TMP_TABLE;
|
||||||
if (!lex->describe)
|
if (lex->describe)
|
||||||
sl->exclude();
|
sl->exclude();
|
||||||
t->db=(tables && tables->db) ? tables->db : (char *)"";
|
t->db=(char *)"";
|
||||||
t->derived=(SELECT_LEX *)0; // just in case ...
|
t->derived=(SELECT_LEX *)0; // just in case ...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1173,6 +1173,8 @@ bool st_select_lex_unit::create_total_list_n_last_return(THD *thd, st_lex *lex,
|
|||||||
net_printf(thd,ER_WRONG_USAGE,"UNION","ORDER BY");
|
net_printf(thd,ER_WRONG_USAGE,"UNION","ORDER BY");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
if (sl->linkage == DERIVED_TABLE_TYPE)
|
||||||
|
continue;
|
||||||
for (SELECT_LEX_UNIT *inner= sl->first_inner_unit();
|
for (SELECT_LEX_UNIT *inner= sl->first_inner_unit();
|
||||||
inner;
|
inner;
|
||||||
inner= inner->next_unit())
|
inner= inner->next_unit())
|
||||||
|
Reference in New Issue
Block a user