Details
-
Technical task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.3(EOL)
-
10.2.2-3, 10.2.2-1, 10.2.2-2, 10.2.2-4, 10.1.18
Description
We'll solve MDEV-13418 by translating:
SELECT 1, a INTO a, b FROM dual; |
into
DECLARE a_tmp TYPE OF a; |
DECLARE b_tmp TYPE OF b; |
SELECT 1, a INTO a, b FROM dual; |
SET a=a_tmp; |
SET b=b_tmp; |
Notice, this will need auto-generated assignments between SP variables (a=a_tmp and b=b_tmp).
Normally assignment is done via sp_instr_set, but it does not suite well here because it needs:
- an Item for the assignment source
- a LEX containing this Item
Instead of creating an Item and a LEX (whose sizeof are 208 and 5896 bytes respectively),
we'll introduce a new sp_instr_setvar which will copy between two variables directly, with no Item and LEX, using their offsets in sp_rcontext::m_var_table.
In order to implement this, we'll need some changes for ROW-type SP variables.
Currently ROW variables store their members inside Item_splocal_row::m_table.
We'll do the following:
- Create a new class Field_row and move m_table from Item_splocal_row to Field_row
class Field_row: public Field_null
{
class Virtual_tmp_table *m_table;
public:
Field_row(uchar *ptr_arg, const LEX_CSTRING *field_name_arg)
:Field_null(ptr_arg, 0, Field::NONE, field_name_arg, &my_charset_bin),
m_table(NULL)
{}
};
- Remove the class Item_splocal_row and use Item_splocal instead by passing &type_handler_row to the constructor.
- Change Item_splocal::Item_splocal to accept const Type_handler *handler instead of enum_field_types sp_var_type.
- Remove the class Item_spvar_args and derive Item_field_row directly from Item_args
- Move row_create_items() and get_row_field() from Item_spvar_args to Item_field_row and fix them to use Field_row::m_table instead of Item_spvar_args::m_table.
- Replace DBUG_ASSERT in Type_handler_row::Column_definition_fix_attributes(), Type_handler_row::Column_definition_prepare_stage1(), Type_handler_row::Column_definition_prepare_stage2() to real appropriate implementations.
Attachments
Issue Links
- blocks
-
MDEV-13418 Compatibility: The order of evaluation of SELECT..INTO assignments
- Stalled
- relates to
-
MDEV-14139 Anchored data types for variables
- Closed
-
MDEV-31250 ROW variables do not get assigned from subselects
- Closed
-
MDEV-32380 Array data type for stored routnes
- Stalled