summaryrefslogtreecommitdiff
path: root/sql/sp_head.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-11-19 19:58:27 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2018-11-19 20:22:33 +0200
commitdde2ca4aa108b611b5fdfc970146b28461ef08bf (patch)
tree08f90bb9d54413af23230ccf99f18391596afa34 /sql/sp_head.cc
parentb5ac863f1494920b5e7035c9dfa0ebfdaa50a15d (diff)
parentfd58bb71e22196c3c5e8d20b92bce6f343f1dea1 (diff)
downloadmariadb-git-dde2ca4aa108b611b5fdfc970146b28461ef08bf.tar.gz
Merge 10.3 into 10.4
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r--sql/sp_head.cc28
1 files changed, 15 insertions, 13 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index c86edc47bf9..56b4fc8c948 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -4444,24 +4444,26 @@ sp_instr_cursor_copy_struct::exec_core(THD *thd, uint *nextp)
*/
if (!row->arguments())
{
- sp_cursor tmp(thd, &m_lex_keeper);
+ sp_cursor tmp(thd, &m_lex_keeper, true);
// Open the cursor without copying data
- if (!(ret= tmp.open_view_structure_only(thd)))
+ if (!(ret= tmp.open(thd)))
{
Row_definition_list defs;
+ /*
+ Create row elements on the caller arena.
+ It's the same arena that was used during sp_rcontext::create().
+ This puts cursor%ROWTYPE elements on the same mem_root
+ where explicit ROW elements and table%ROWTYPE reside:
+ - tmp.export_structure() allocates new Spvar_definition instances
+ and their components (such as TYPELIBs).
+ - row->row_create_items() creates new Item_field instances.
+ They all are created on the same mem_root.
+ */
+ Query_arena current_arena;
+ thd->set_n_backup_active_arena(thd->spcont->callers_arena, &current_arena);
if (!(ret= tmp.export_structure(thd, &defs)))
- {
- /*
- Create row elements on the caller arena.
- It's the same arena that was used during sp_rcontext::create().
- This puts cursor%ROWTYPE elements on the same mem_root
- where explicit ROW elements and table%ROWTYPE reside.
- */
- Query_arena current_arena;
- thd->set_n_backup_active_arena(thd->spcont->callers_arena, &current_arena);
row->row_create_items(thd, &defs);
- thd->restore_active_arena(thd->spcont->callers_arena, &current_arena);
- }
+ thd->restore_active_arena(thd->spcont->callers_arena, &current_arena);
tmp.close(thd);
}
}