Loading mysql-test/r/derived.result +5 −5 Original line number Diff line number Diff line Loading @@ -330,11 +330,6 @@ SELECT MIN(price) min, MAX(price) max, AVG(price) avg FROM (SELECT SUBSTRING( MA min max avg 10.00 10.00 10 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); 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; Loading @@ -344,3 +339,8 @@ select distinct sum(b) from (select a,b from t1) y group by a; sum(b) 4 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; mysql-test/r/func_str.result +0 −6 Original line number Diff line number Diff line Loading @@ -707,12 +707,6 @@ select count(*) as total, left(c,10) as reg from t1 group by reg order by reg de total reg 10 2004-12-10 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"; must_be_null NULL Loading sql/item.cc +1 −1 Original line number Diff line number Diff line Loading @@ -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) { DBUG_ASSERT(*select_ref); if (!last->ref_pointer_array[counter]) if (!select->ref_pointer_array[counter]) { my_error(ER_ILLEGAL_REFERENCE, MYF(0), ref->name, "forward reference in item list"); Loading sql/sql_show.cc +16 −15 Original line number Diff line number Diff line Loading @@ -1786,7 +1786,9 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) enum enum_schema_tables schema_table_idx; thr_lock_type lock_type; List<char> bases; List_iterator_fast<char> it(bases); COND *partial_cond; int error= 1; DBUG_ENTER("get_all_tables"); LINT_INIT(end); Loading @@ -1803,13 +1805,11 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) if (schema_table->process_table(thd, show_table_list, table, res, show_table_list->db, show_table_list->alias)) { DBUG_RETURN(1); } goto err; close_thread_tables(thd, 0, 0, old_open_tables); show_table_list->table= 0; lex->all_selects_list= select_lex; DBUG_RETURN(0); error= 0; goto err; } lex->all_selects_list= &sel; Loading @@ -1822,14 +1822,14 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) /* information schema name always is first in list */ 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, 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); it.rewind(); /* To get access to new elements in basis list */ while ((base_name= it++) || /* generate error for non existing database. Loading @@ -1851,7 +1851,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) if (with_i_schema) // information schema table names { if (schema_tables_add(thd, &files, idx_field_vals.table_value)) DBUG_RETURN(1); goto err; } else { Loading @@ -1860,7 +1860,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) len= FN_LEN - len; if (mysql_find_files(thd, &files, base_name, path, idx_field_vals.table_value, 0)) DBUG_RETURN(1); goto err; } List_iterator_fast<char> it_files(files); Loading Loading @@ -1906,16 +1906,14 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) int res; TABLE *old_open_tables= thd->open_tables; 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; show_table_list->lock_type= lock_type; res= open_and_lock_tables(thd, show_table_list); if (schema_table->process_table(thd, show_table_list, table, res, base_name, show_table_list->alias)) { DBUG_RETURN(1); } goto err; close_thread_tables(thd, 0, 0, old_open_tables); } } Loading @@ -1927,8 +1925,11 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) with_i_schema= 0; } } error= 0; err: lex->all_selects_list= select_lex; DBUG_RETURN(0); DBUG_RETURN(error); } Loading Loading
mysql-test/r/derived.result +5 −5 Original line number Diff line number Diff line Loading @@ -330,11 +330,6 @@ SELECT MIN(price) min, MAX(price) max, AVG(price) avg FROM (SELECT SUBSTRING( MA min max avg 10.00 10.00 10 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); 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; Loading @@ -344,3 +339,8 @@ select distinct sum(b) from (select a,b from t1) y group by a; sum(b) 4 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;
mysql-test/r/func_str.result +0 −6 Original line number Diff line number Diff line Loading @@ -707,12 +707,6 @@ select count(*) as total, left(c,10) as reg from t1 group by reg order by reg de total reg 10 2004-12-10 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"; must_be_null NULL Loading
sql/item.cc +1 −1 Original line number Diff line number Diff line Loading @@ -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) { DBUG_ASSERT(*select_ref); if (!last->ref_pointer_array[counter]) if (!select->ref_pointer_array[counter]) { my_error(ER_ILLEGAL_REFERENCE, MYF(0), ref->name, "forward reference in item list"); Loading
sql/sql_show.cc +16 −15 Original line number Diff line number Diff line Loading @@ -1786,7 +1786,9 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) enum enum_schema_tables schema_table_idx; thr_lock_type lock_type; List<char> bases; List_iterator_fast<char> it(bases); COND *partial_cond; int error= 1; DBUG_ENTER("get_all_tables"); LINT_INIT(end); Loading @@ -1803,13 +1805,11 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) if (schema_table->process_table(thd, show_table_list, table, res, show_table_list->db, show_table_list->alias)) { DBUG_RETURN(1); } goto err; close_thread_tables(thd, 0, 0, old_open_tables); show_table_list->table= 0; lex->all_selects_list= select_lex; DBUG_RETURN(0); error= 0; goto err; } lex->all_selects_list= &sel; Loading @@ -1822,14 +1822,14 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) /* information schema name always is first in list */ 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, 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); it.rewind(); /* To get access to new elements in basis list */ while ((base_name= it++) || /* generate error for non existing database. Loading @@ -1851,7 +1851,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) if (with_i_schema) // information schema table names { if (schema_tables_add(thd, &files, idx_field_vals.table_value)) DBUG_RETURN(1); goto err; } else { Loading @@ -1860,7 +1860,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) len= FN_LEN - len; if (mysql_find_files(thd, &files, base_name, path, idx_field_vals.table_value, 0)) DBUG_RETURN(1); goto err; } List_iterator_fast<char> it_files(files); Loading Loading @@ -1906,16 +1906,14 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) int res; TABLE *old_open_tables= thd->open_tables; 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; show_table_list->lock_type= lock_type; res= open_and_lock_tables(thd, show_table_list); if (schema_table->process_table(thd, show_table_list, table, res, base_name, show_table_list->alias)) { DBUG_RETURN(1); } goto err; close_thread_tables(thd, 0, 0, old_open_tables); } } Loading @@ -1927,8 +1925,11 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) with_i_schema= 0; } } error= 0; err: lex->all_selects_list= select_lex; DBUG_RETURN(0); DBUG_RETURN(error); } Loading