mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-14689 Server crashes in find_field_in_tables on 2nd execution of PS with versioned table and view
SQL: wrong usage of Item::transform()
This commit is contained in:
@ -107,5 +107,14 @@ create or replace view vt1 as select * from t1 union select * from t2;
|
||||
select * from vt1;
|
||||
a
|
||||
1
|
||||
# MDEV-14689 crash on second PS execute
|
||||
create or replace table t1 (a int);
|
||||
create or replace view v1 as select * from t1;
|
||||
create or replace table t2 (b int) with system versioning;
|
||||
prepare stmt from 'select a from v1 inner join t2 group by a order by a';
|
||||
execute stmt;
|
||||
a
|
||||
execute stmt;
|
||||
a
|
||||
drop database test;
|
||||
create database test;
|
||||
|
@ -89,5 +89,14 @@ create or replace table t2 (a int);
|
||||
create or replace view vt1 as select * from t1 union select * from t2;
|
||||
select * from vt1;
|
||||
|
||||
--echo # MDEV-14689 crash on second PS execute
|
||||
create or replace table t1 (a int);
|
||||
create or replace view v1 as select * from t1;
|
||||
create or replace table t2 (b int) with system versioning;
|
||||
prepare stmt from 'select a from v1 inner join t2 group by a order by a';
|
||||
execute stmt;
|
||||
execute stmt;
|
||||
|
||||
|
||||
drop database test;
|
||||
create database test;
|
||||
|
@ -700,24 +700,36 @@ void JOIN::vers_check_items()
|
||||
|
||||
if (conds)
|
||||
{
|
||||
conds= conds->transform(thd, transformer, NULL);
|
||||
Item *tmp = conds->transform(thd, transformer, NULL);
|
||||
if (conds != tmp)
|
||||
conds= tmp;
|
||||
}
|
||||
|
||||
for (ORDER *ord= order; ord; ord= ord->next)
|
||||
{
|
||||
ord->item_ptr= (*ord->item)->transform(thd, transformer, NULL);
|
||||
*ord->item= ord->item_ptr;
|
||||
Item *tmp= (*ord->item)->transform(thd, transformer, NULL);
|
||||
if (*ord->item != tmp)
|
||||
{
|
||||
ord->item_ptr= tmp;
|
||||
*ord->item= ord->item_ptr;
|
||||
}
|
||||
}
|
||||
|
||||
for (ORDER *ord= group_list; ord; ord= ord->next)
|
||||
{
|
||||
ord->item_ptr= (*ord->item)->transform(thd, transformer, NULL);
|
||||
*ord->item= ord->item_ptr;
|
||||
Item *tmp= (*ord->item)->transform(thd, transformer, NULL);
|
||||
if (*ord->item != tmp)
|
||||
{
|
||||
ord->item_ptr= tmp;
|
||||
*ord->item= ord->item_ptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (having)
|
||||
{
|
||||
having= having->transform(thd, transformer, NULL);
|
||||
Item *tmp= having->transform(thd, transformer, NULL);
|
||||
if (having != tmp)
|
||||
having= tmp;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user