mirror of
https://github.com/MariaDB/server.git
synced 2025-08-05 13:16:09 +03:00
revision of fix_fields calls in subqueries transformation
after merge fix
This commit is contained in:
@@ -713,9 +713,14 @@ Item_in_subselect::single_value_transformer(JOIN *join,
|
|||||||
select_lex->ref_pointer_array,
|
select_lex->ref_pointer_array,
|
||||||
(char *)"<ref>",
|
(char *)"<ref>",
|
||||||
this->full_name()));
|
this->full_name()));
|
||||||
|
/*
|
||||||
|
AND and comparison functions can't be changed during fix_fields()
|
||||||
|
we can assign select_lex->having here, and pass 0 as last
|
||||||
|
argument (reference) to fix_fields()
|
||||||
|
*/
|
||||||
select_lex->having= join->having= and_items(join->having, item);
|
select_lex->having= join->having= and_items(join->having, item);
|
||||||
select_lex->having_fix_field= 1;
|
select_lex->having_fix_field= 1;
|
||||||
if (join->having->fix_fields(thd, join->tables_list, &join->having))
|
if (join->having->fix_fields(thd, join->tables_list, 0))
|
||||||
{
|
{
|
||||||
select_lex->having_fix_field= 0;
|
select_lex->having_fix_field= 0;
|
||||||
goto err;
|
goto err;
|
||||||
@@ -735,13 +740,17 @@ Item_in_subselect::single_value_transformer(JOIN *join,
|
|||||||
if (!abort_on_null)
|
if (!abort_on_null)
|
||||||
{
|
{
|
||||||
having= new Item_is_not_null_test(this, having);
|
having= new Item_is_not_null_test(this, having);
|
||||||
|
/*
|
||||||
|
Item_is_not_null_test can't be changed during fix_fields()
|
||||||
|
we can assign select_lex->having here, and pass 0 as last
|
||||||
|
argument (reference) to fix_fields()
|
||||||
|
*/
|
||||||
select_lex->having=
|
select_lex->having=
|
||||||
join->having= (join->having ?
|
join->having= (join->having ?
|
||||||
new Item_cond_and(having, join->having) :
|
new Item_cond_and(having, join->having) :
|
||||||
having);
|
having);
|
||||||
select_lex->having_fix_field= 1;
|
select_lex->having_fix_field= 1;
|
||||||
if (join->having->fix_fields(thd, join->tables_list,
|
if (join->having->fix_fields(thd, join->tables_list, 0))
|
||||||
&join->having))
|
|
||||||
{
|
{
|
||||||
select_lex->having_fix_field= 0;
|
select_lex->having_fix_field= 0;
|
||||||
goto err;
|
goto err;
|
||||||
@@ -751,14 +760,24 @@ Item_in_subselect::single_value_transformer(JOIN *join,
|
|||||||
new Item_func_isnull(isnull));
|
new Item_func_isnull(isnull));
|
||||||
}
|
}
|
||||||
item->name= (char *)in_additional_cond;
|
item->name= (char *)in_additional_cond;
|
||||||
|
/*
|
||||||
|
AND can't be changed during fix_fields()
|
||||||
|
we can assign select_lex->having here, and pass 0 as last
|
||||||
|
argument (reference) to fix_fields()
|
||||||
|
*/
|
||||||
select_lex->where= join->conds= and_items(join->conds, item);
|
select_lex->where= join->conds= and_items(join->conds, item);
|
||||||
if (join->conds->fix_fields(thd, join->tables_list, &join->conds))
|
if (join->conds->fix_fields(thd, join->tables_list, 0))
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (select_lex->master_unit()->first_select()->next_select())
|
if (select_lex->master_unit()->first_select()->next_select())
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
comparison functions can't be changed during fix_fields()
|
||||||
|
we can assign select_lex->having here, and pass 0 as last
|
||||||
|
argument (reference) to fix_fields()
|
||||||
|
*/
|
||||||
select_lex->having=
|
select_lex->having=
|
||||||
join->having=
|
join->having=
|
||||||
func->create(expr,
|
func->create(expr,
|
||||||
@@ -767,7 +786,7 @@ Item_in_subselect::single_value_transformer(JOIN *join,
|
|||||||
(char *)"<result>"));
|
(char *)"<result>"));
|
||||||
select_lex->having_fix_field= 1;
|
select_lex->having_fix_field= 1;
|
||||||
if (join->having->fix_fields(thd, join->tables_list,
|
if (join->having->fix_fields(thd, join->tables_list,
|
||||||
&join->having))
|
0))
|
||||||
{
|
{
|
||||||
select_lex->having_fix_field= 0;
|
select_lex->having_fix_field= 0;
|
||||||
goto err;
|
goto err;
|
||||||
@@ -880,9 +899,14 @@ Item_in_subselect::row_value_transformer(JOIN *join)
|
|||||||
select_lex->group_list.first ||
|
select_lex->group_list.first ||
|
||||||
!select_lex->table_list.elements)
|
!select_lex->table_list.elements)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
AND can't be changed during fix_fields()
|
||||||
|
we can assign select_lex->having here, and pass 0 as last
|
||||||
|
argument (reference) to fix_fields()
|
||||||
|
*/
|
||||||
select_lex->having= join->having= and_items(join->having, item);
|
select_lex->having= join->having= and_items(join->having, item);
|
||||||
select_lex->having_fix_field= 1;
|
select_lex->having_fix_field= 1;
|
||||||
if (join->having->fix_fields(thd, join->tables_list, &join->having))
|
if (join->having->fix_fields(thd, join->tables_list, 0))
|
||||||
{
|
{
|
||||||
select_lex->having_fix_field= 0;
|
select_lex->having_fix_field= 0;
|
||||||
goto err;
|
goto err;
|
||||||
@@ -891,8 +915,13 @@ Item_in_subselect::row_value_transformer(JOIN *join)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
AND can't be changed during fix_fields()
|
||||||
|
we can assign select_lex->having here, and pass 0 as last
|
||||||
|
argument (reference) to fix_fields()
|
||||||
|
*/
|
||||||
select_lex->where= join->conds= and_items(join->conds, item);
|
select_lex->where= join->conds= and_items(join->conds, item);
|
||||||
if (join->conds->fix_fields(thd, join->tables_list, &join->having))
|
if (join->conds->fix_fields(thd, join->tables_list, 0))
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (stmt)
|
if (stmt)
|
||||||
|
@@ -697,6 +697,8 @@ static bool mysql_test_upd_fields(Prepared_statement *stmt,
|
|||||||
// this memory pool was opened in open_and_lock_tables
|
// this memory pool was opened in open_and_lock_tables
|
||||||
thd->ps_setup_free_memory();
|
thd->ps_setup_free_memory();
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
|
}
|
||||||
|
|
||||||
if (setup_tables(table_list) ||
|
if (setup_tables(table_list) ||
|
||||||
setup_fields(thd, 0, table_list, fields, 1, 0, 0) ||
|
setup_fields(thd, 0, table_list, fields, 1, 0, 0) ||
|
||||||
setup_conds(thd, table_list, &conds) || thd->net.report_error)
|
setup_conds(thd, table_list, &conds) || thd->net.report_error)
|
||||||
|
Reference in New Issue
Block a user