summaryrefslogtreecommitdiff
path: root/sql/table.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/table.cc')
-rw-r--r--sql/table.cc37
1 files changed, 29 insertions, 8 deletions
diff --git a/sql/table.cc b/sql/table.cc
index 40304dc6fdc..b8161093e9a 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1439,25 +1439,33 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
{
/*
Get virtual column data stored in the .frm file as follows:
- byte 1 = 1 (always 1 to allow for future extensions)
+ byte 1 = 1 | 2
byte 2 = sql_type
byte 3 = flags (as of now, 0 - no flags, 1 - field is physically stored)
- byte 4-... = virtual column expression (text data)
+ [byte 4] = optional interval_id for sql_type (only if byte 1 == 2)
+ next byte ... = virtual column expression (text data)
*/
vcol_info= new Virtual_column_info();
- if ((uint)vcol_screen_pos[0] != 1)
+ bool opt_interval_id= (uint)vcol_screen_pos[0] == 2;
+ field_type= (enum_field_types) (uchar) vcol_screen_pos[1];
+ if (opt_interval_id)
+ interval_nr= (uint)vcol_screen_pos[3];
+ else if ((uint)vcol_screen_pos[0] != 1)
{
error= 4;
goto err;
}
- field_type= (enum_field_types) (uchar) vcol_screen_pos[1];
fld_stored_in_db= (bool) (uint) vcol_screen_pos[2];
- vcol_expr_length= vcol_info_length-(uint)FRM_VCOL_HEADER_SIZE;
+ vcol_expr_length= vcol_info_length -
+ (uint)(FRM_VCOL_HEADER_SIZE(opt_interval_id));
if (!(vcol_info->expr_str.str=
(char *)memdup_root(&share->mem_root,
- vcol_screen_pos+(uint)FRM_VCOL_HEADER_SIZE,
+ vcol_screen_pos +
+ (uint) FRM_VCOL_HEADER_SIZE(opt_interval_id),
vcol_expr_length)))
goto err;
+ if (opt_interval_id)
+ interval_nr= (uint) vcol_screen_pos[3];
vcol_info->expr_str.length= vcol_expr_length;
vcol_screen_pos+= vcol_info_length;
share->vfields++;
@@ -4536,7 +4544,14 @@ bool TABLE_LIST::check_single_table(TABLE_LIST **table_arg,
tbl;
tbl= tbl->next_local)
{
- if (tbl->table)
+ /*
+ Merged view has also temporary table attached (in 5.2 if it has table
+ then it was real table), so we have filter such temporary tables out
+ by checking that it is not merged view
+ */
+ if (tbl->table &&
+ !(tbl->is_view() &&
+ tbl->is_merged_derived()))
{
if (tbl->table->map & map)
{
@@ -5985,7 +6000,13 @@ void TABLE::use_index(int key_to_save)
bool TABLE::is_filled_at_execution()
{
- return test(pos_in_table_list->jtbm_subselect ||
+ /*
+ pos_in_table_list == NULL for internal temporary tables because they
+ do not have a corresponding table reference. Such tables are filled
+ during execution.
+ */
+ return test(!pos_in_table_list ||
+ pos_in_table_list->jtbm_subselect ||
pos_in_table_list->is_active_sjm());
}