Commit b233ddba authored by monty@mysql.com's avatar monty@mysql.com

After merge fixes

parent 43eb7cf3
...@@ -330,11 +330,6 @@ SELECT MIN(price) min, MAX(price) max, AVG(price) avg FROM (SELECT SUBSTRING( MA ...@@ -330,11 +330,6 @@ SELECT MIN(price) min, MAX(price) max, AVG(price) avg FROM (SELECT SUBSTRING( MA
min max avg min max avg
10.00 10.00 10 10.00 10.00 10
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a char(10), b char(10));
INSERT INTO t1 VALUES ('root','localhost'), ('root','%');
SELECT * FROM (SELECT (SELECT a.a FROM t1 AS a WHERE a.a = b.a) FROM t1 AS b) AS c;
ERROR 21000: Subquery returns more than 1 row
DROP TABLE t1;
create table t1 (a integer, b integer); create table t1 (a integer, b integer);
insert into t1 values (1,4), (2,2),(2,2), (4,1),(4,1),(4,1),(4,1); insert into t1 values (1,4), (2,2),(2,2), (4,1),(4,1),(4,1),(4,1);
select distinct sum(b) from t1 group by a; select distinct sum(b) from t1 group by a;
...@@ -344,3 +339,8 @@ select distinct sum(b) from (select a,b from t1) y group by a; ...@@ -344,3 +339,8 @@ select distinct sum(b) from (select a,b from t1) y group by a;
sum(b) sum(b)
4 4
drop table t1; drop table t1;
CREATE TABLE t1 (a char(10), b char(10));
INSERT INTO t1 VALUES ('root','localhost'), ('root','%');
SELECT * FROM (SELECT (SELECT a.a FROM t1 AS a WHERE a.a = b.a) FROM t1 AS b) AS c;
ERROR 21000: Subquery returns more than 1 row
DROP TABLE t1;
...@@ -707,12 +707,6 @@ select count(*) as total, left(c,10) as reg from t1 group by reg order by reg de ...@@ -707,12 +707,6 @@ select count(*) as total, left(c,10) as reg from t1 group by reg order by reg de
total reg total reg
10 2004-12-10 10 2004-12-10
drop table t1; drop table t1;
select quote(ltrim(concat(' ', 'a')));
quote(ltrim(concat(' ', 'a')))
'a'
select quote(trim(concat(' ', 'a')));
quote(trim(concat(' ', 'a')))
'a'
select trim(null from 'kate') as "must_be_null"; select trim(null from 'kate') as "must_be_null";
must_be_null must_be_null
NULL NULL
......
...@@ -1775,7 +1775,7 @@ resolve_ref_in_select_and_group(THD *thd, Item_ident *ref, SELECT_LEX *select) ...@@ -1775,7 +1775,7 @@ resolve_ref_in_select_and_group(THD *thd, Item_ident *ref, SELECT_LEX *select)
if (select_ref != not_found_item && !ambiguous_fields) if (select_ref != not_found_item && !ambiguous_fields)
{ {
DBUG_ASSERT(*select_ref); DBUG_ASSERT(*select_ref);
if (!last->ref_pointer_array[counter]) if (!select->ref_pointer_array[counter])
{ {
my_error(ER_ILLEGAL_REFERENCE, MYF(0), my_error(ER_ILLEGAL_REFERENCE, MYF(0),
ref->name, "forward reference in item list"); ref->name, "forward reference in item list");
......
...@@ -1786,7 +1786,9 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) ...@@ -1786,7 +1786,9 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
enum enum_schema_tables schema_table_idx; enum enum_schema_tables schema_table_idx;
thr_lock_type lock_type; thr_lock_type lock_type;
List<char> bases; List<char> bases;
List_iterator_fast<char> it(bases);
COND *partial_cond; COND *partial_cond;
int error= 1;
DBUG_ENTER("get_all_tables"); DBUG_ENTER("get_all_tables");
LINT_INIT(end); LINT_INIT(end);
...@@ -1803,13 +1805,11 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) ...@@ -1803,13 +1805,11 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
if (schema_table->process_table(thd, show_table_list, if (schema_table->process_table(thd, show_table_list,
table, res, show_table_list->db, table, res, show_table_list->db,
show_table_list->alias)) show_table_list->alias))
{ goto err;
DBUG_RETURN(1);
}
close_thread_tables(thd, 0, 0, old_open_tables); close_thread_tables(thd, 0, 0, old_open_tables);
show_table_list->table= 0; show_table_list->table= 0;
lex->all_selects_list= select_lex; error= 0;
DBUG_RETURN(0); goto err;
} }
lex->all_selects_list= &sel; lex->all_selects_list= &sel;
...@@ -1822,14 +1822,14 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) ...@@ -1822,14 +1822,14 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
/* information schema name always is first in list */ /* information schema name always is first in list */
if (schema_db_add(thd, &bases, idx_field_vals.db_value, &with_i_schema)) if (schema_db_add(thd, &bases, idx_field_vals.db_value, &with_i_schema))
return 1; goto err;
if (mysql_find_files(thd, &bases, NullS, mysql_data_home, if (mysql_find_files(thd, &bases, NullS, mysql_data_home,
idx_field_vals.db_value, 1)) idx_field_vals.db_value, 1))
return 1; goto err;
List_iterator_fast<char> it(bases);
partial_cond= make_cond_for_info_schema(cond, tables); partial_cond= make_cond_for_info_schema(cond, tables);
it.rewind(); /* To get access to new elements in basis list */
while ((base_name= it++) || while ((base_name= it++) ||
/* /*
generate error for non existing database. generate error for non existing database.
...@@ -1851,7 +1851,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) ...@@ -1851,7 +1851,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
if (with_i_schema) // information schema table names if (with_i_schema) // information schema table names
{ {
if (schema_tables_add(thd, &files, idx_field_vals.table_value)) if (schema_tables_add(thd, &files, idx_field_vals.table_value))
DBUG_RETURN(1); goto err;
} }
else else
{ {
...@@ -1860,7 +1860,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) ...@@ -1860,7 +1860,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
len= FN_LEN - len; len= FN_LEN - len;
if (mysql_find_files(thd, &files, base_name, if (mysql_find_files(thd, &files, base_name,
path, idx_field_vals.table_value, 0)) path, idx_field_vals.table_value, 0))
DBUG_RETURN(1); goto err;
} }
List_iterator_fast<char> it_files(files); List_iterator_fast<char> it_files(files);
...@@ -1906,16 +1906,14 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) ...@@ -1906,16 +1906,14 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
int res; int res;
TABLE *old_open_tables= thd->open_tables; TABLE *old_open_tables= thd->open_tables;
if (make_table_list(thd, &sel, base_name, file_name)) if (make_table_list(thd, &sel, base_name, file_name))
DBUG_RETURN(1); goto err;
TABLE_LIST *show_table_list= (TABLE_LIST*) sel.table_list.first; TABLE_LIST *show_table_list= (TABLE_LIST*) sel.table_list.first;
show_table_list->lock_type= lock_type; show_table_list->lock_type= lock_type;
res= open_and_lock_tables(thd, show_table_list); res= open_and_lock_tables(thd, show_table_list);
if (schema_table->process_table(thd, show_table_list, table, if (schema_table->process_table(thd, show_table_list, table,
res, base_name, res, base_name,
show_table_list->alias)) show_table_list->alias))
{ goto err;
DBUG_RETURN(1);
}
close_thread_tables(thd, 0, 0, old_open_tables); close_thread_tables(thd, 0, 0, old_open_tables);
} }
} }
...@@ -1927,8 +1925,11 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) ...@@ -1927,8 +1925,11 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
with_i_schema= 0; with_i_schema= 0;
} }
} }
error= 0;
err:
lex->all_selects_list= select_lex; lex->all_selects_list= select_lex;
DBUG_RETURN(0); DBUG_RETURN(error);
} }
......
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