Commit d64702d4 authored by kevg's avatar kevg Committed by Aleksey Midenkov

SQL: different results when querying a VIEW from PREPARED STATEMENT and without it [fixes #176]

parent ecd18bc0
...@@ -39,8 +39,6 @@ x ...@@ -39,8 +39,6 @@ x
drop prepare stmt; drop prepare stmt;
select * from vt1; select * from vt1;
x x
2
1
prepare stmt from 'select * from vt1'; prepare stmt from 'select * from vt1';
execute stmt; execute stmt;
x x
...@@ -50,7 +48,6 @@ x ...@@ -50,7 +48,6 @@ x
1 1
select * from vt1 for system_time as of timestamp @t1; select * from vt1 for system_time as of timestamp @t1;
x x
2
1 1
prepare stmt from 'select * from vt1 for system_time as of timestamp @t1'; prepare stmt from 'select * from vt1 for system_time as of timestamp @t1';
execute stmt; execute stmt;
......
...@@ -703,11 +703,6 @@ int vers_setup_select(THD *thd, TABLE_LIST *tables, COND **where_expr, ...@@ -703,11 +703,6 @@ int vers_setup_select(THD *thd, TABLE_LIST *tables, COND **where_expr,
DBUG_RETURN(0); DBUG_RETURN(0);
} }
while (tables && tables->is_view() && !thd->stmt_arena->is_stmt_prepare())
{
tables= tables->view->select_lex.table_list.first;
}
for (table= tables; table; table= table->next_local) for (table= tables; table; table= table->next_local)
{ {
if (table->table && table->table->versioned()) if (table->table && table->table->versioned())
...@@ -16879,9 +16874,9 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields, ...@@ -16879,9 +16874,9 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
continue; // Some kind of const item continue; // Some kind of const item
} }
if (type == Item::FIELD_ITEM) if (type == Item::FIELD_ITEM || type == Item::REF_ITEM)
{ {
Item_field *item_field= (Item_field *)item; Item_field *item_field= (Item_field *)item->real_item();
Field *field= item_field->field; Field *field= item_field->field;
TABLE_SHARE *s= field->table->s; TABLE_SHARE *s= field->table->s;
if (s->versioned) if (s->versioned)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment