diff options
author | Sinisa@sinisa.nasamreza.org <> | 2002-11-30 18:46:24 +0200 |
---|---|---|
committer | Sinisa@sinisa.nasamreza.org <> | 2002-11-30 18:46:24 +0200 |
commit | a968d7c2eac9e1766f85cebf8d4aa4019c543a84 (patch) | |
tree | 8c175da8af2a3a22c0a1c2dcb960bfb557c86049 | |
parent | 02c61db6568d05b8f741d0de8933daa8fa0332dd (diff) | |
download | mariadb-git-a968d7c2eac9e1766f85cebf8d4aa4019c543a84.tar.gz |
many bug fixes
-rw-r--r-- | mysql-test/t/subselect.test | 7 | ||||
-rw-r--r-- | sql/item_func.cc | 4 | ||||
-rw-r--r-- | sql/item_sum.cc | 2 | ||||
-rw-r--r-- | sql/item_sum.h | 2 | ||||
-rw-r--r-- | sql/sql_derived.cc | 3 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 2 |
6 files changed, 11 insertions, 9 deletions
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index d0d66729374..3f997aa3d35 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -15,12 +15,11 @@ SELECT (SELECT 1), a; SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1; -- error 1054 SELECT 1 FROM (SELECT (SELECT a) b) c; -SELECT 1 FROM (SELECT (SELECT a)); -SELECT * FROM (SELECT 1 as id) WHERE id IN (SELECT * FROM (SELECT 1 as id) ORDER BY id LIMIT 1); +SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id LIMIT 1); -- error 1239 -SELECT * FROM (SELECT 1) WHERE 1 IN (SELECT 1,1); +SELECT * FROM (SELECT 1)a WHERE 1 IN (SELECT 1,1); SELECT 1 IN (SELECT 1); -SELECT 1 FROM (SELECT 1 as a) WHERE 1 IN (SELECT (SELECT a)); +SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a)); drop table if exists t1,t2,t3,t4,t5,t6,t7,t8; create table t1 (a int); create table t2 (a int, b int); diff --git a/sql/item_func.cc b/sql/item_func.cc index 364bea4c1f5..1611b5f2257 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -108,8 +108,6 @@ Item_func::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) Set return character set to first argument if we are returning a string. */ - if (result_type() == STRING_RESULT) - set_charset((*args)->charset()); for (arg=args, arg_end=args+arg_count; arg != arg_end ; arg++) { if ((*arg)->check_cols(allowed_arg_cols) || @@ -123,6 +121,8 @@ Item_func::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) used_tables_cache|=(*arg)->used_tables(); const_item_cache&= (*arg)->const_item(); } + if (result_type() == STRING_RESULT) + set_charset((*args)->charset()); } fix_length_and_dec(); fixed= 1; diff --git a/sql/item_sum.cc b/sql/item_sum.cc index fe7523a5fc5..63329cd3823 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -41,7 +41,7 @@ Item_sum::Item_sum(List<Item> &list) list.empty(); // Fields are used } -void Item_sum::mark_as_sum_func() +inline void Item_sum::mark_as_sum_func() { current_thd->lex.current_select->with_sum_func= with_sum_func= 1; } diff --git a/sql/item_sum.h b/sql/item_sum.h index 00803abf25d..56b36b615f4 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -34,6 +34,7 @@ public: uint arg_count; bool quick_group; /* If incremental update of fields */ + inline void mark_as_sum_func(); Item_sum() : arg_count(0),quick_group(1) { mark_as_sum_func(); @@ -54,7 +55,6 @@ public: } Item_sum(List<Item> &list); ~Item_sum() { result_field=0; } - inline void mark_as_sum_func(); enum Type type() const { return SUM_FUNC_ITEM; } virtual enum Sumfunctype sum_func () const=0; diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index 2176740e67b..78356a0d725 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -107,9 +107,12 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t) table->derived_select_number= sl->select_number; table->tmp_table=TMP_TABLE; if (lex->describe) + tables->table_list->table=tables->table; // to fix a problem in EXPLAIN + else sl->exclude(); t->db=(char *)""; t->derived=(SELECT_LEX *)0; // just in case ... + table->file->info(HA_STATUS_VARIABLE); } } delete derived_result; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 13836902736..b3ca9125c10 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2977,7 +2977,7 @@ insert_values: lex->lock_option= (using_update_log) ? TL_READ_NO_INSERT : TL_READ; mysql_init_select(lex); } - select_options select_item_list select_from select_lock_type + select_options select_item_list opt_select_from select_lock_type union_clause {} ; |