mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
many bug fixes
This commit is contained in:
@ -15,12 +15,11 @@ 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;
|
||||||
-- error 1054
|
-- error 1054
|
||||||
SELECT 1 FROM (SELECT (SELECT a) b) c;
|
SELECT 1 FROM (SELECT (SELECT a) b) c;
|
||||||
SELECT 1 FROM (SELECT (SELECT a));
|
SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id LIMIT 1);
|
||||||
SELECT * FROM (SELECT 1 as id) WHERE id IN (SELECT * FROM (SELECT 1 as id) ORDER BY id LIMIT 1);
|
|
||||||
-- error 1239
|
-- 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 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;
|
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8;
|
||||||
create table t1 (a int);
|
create table t1 (a int);
|
||||||
create table t2 (a int, b int);
|
create table t2 (a int, b int);
|
||||||
|
@ -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
|
Set return character set to first argument if we are returning a
|
||||||
string.
|
string.
|
||||||
*/
|
*/
|
||||||
if (result_type() == STRING_RESULT)
|
|
||||||
set_charset((*args)->charset());
|
|
||||||
for (arg=args, arg_end=args+arg_count; arg != arg_end ; arg++)
|
for (arg=args, arg_end=args+arg_count; arg != arg_end ; arg++)
|
||||||
{
|
{
|
||||||
if ((*arg)->check_cols(allowed_arg_cols) ||
|
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();
|
used_tables_cache|=(*arg)->used_tables();
|
||||||
const_item_cache&= (*arg)->const_item();
|
const_item_cache&= (*arg)->const_item();
|
||||||
}
|
}
|
||||||
|
if (result_type() == STRING_RESULT)
|
||||||
|
set_charset((*args)->charset());
|
||||||
}
|
}
|
||||||
fix_length_and_dec();
|
fix_length_and_dec();
|
||||||
fixed= 1;
|
fixed= 1;
|
||||||
|
@ -41,7 +41,7 @@ Item_sum::Item_sum(List<Item> &list)
|
|||||||
list.empty(); // Fields are used
|
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;
|
current_thd->lex.current_select->with_sum_func= with_sum_func= 1;
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ public:
|
|||||||
uint arg_count;
|
uint arg_count;
|
||||||
bool quick_group; /* If incremental update of fields */
|
bool quick_group; /* If incremental update of fields */
|
||||||
|
|
||||||
|
inline void mark_as_sum_func();
|
||||||
Item_sum() : arg_count(0),quick_group(1)
|
Item_sum() : arg_count(0),quick_group(1)
|
||||||
{
|
{
|
||||||
mark_as_sum_func();
|
mark_as_sum_func();
|
||||||
@ -54,7 +55,6 @@ public:
|
|||||||
}
|
}
|
||||||
Item_sum(List<Item> &list);
|
Item_sum(List<Item> &list);
|
||||||
~Item_sum() { result_field=0; }
|
~Item_sum() { result_field=0; }
|
||||||
inline void mark_as_sum_func();
|
|
||||||
|
|
||||||
enum Type type() const { return SUM_FUNC_ITEM; }
|
enum Type type() const { return SUM_FUNC_ITEM; }
|
||||||
virtual enum Sumfunctype sum_func () const=0;
|
virtual enum Sumfunctype sum_func () const=0;
|
||||||
|
@ -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->derived_select_number= sl->select_number;
|
||||||
table->tmp_table=TMP_TABLE;
|
table->tmp_table=TMP_TABLE;
|
||||||
if (lex->describe)
|
if (lex->describe)
|
||||||
|
tables->table_list->table=tables->table; // to fix a problem in EXPLAIN
|
||||||
|
else
|
||||||
sl->exclude();
|
sl->exclude();
|
||||||
t->db=(char *)"";
|
t->db=(char *)"";
|
||||||
t->derived=(SELECT_LEX *)0; // just in case ...
|
t->derived=(SELECT_LEX *)0; // just in case ...
|
||||||
|
table->file->info(HA_STATUS_VARIABLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete derived_result;
|
delete derived_result;
|
||||||
|
@ -2977,7 +2977,7 @@ insert_values:
|
|||||||
lex->lock_option= (using_update_log) ? TL_READ_NO_INSERT : TL_READ;
|
lex->lock_option= (using_update_log) ? TL_READ_NO_INSERT : TL_READ;
|
||||||
mysql_init_select(lex);
|
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 {}
|
union_clause {}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user