summaryrefslogtreecommitdiff
path: root/sql/sp_head.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2018-11-09 09:45:37 +0400
committerAlexander Barkov <bar@mariadb.com>2018-11-09 09:56:02 +0400
commit3074beaad6bf259c6427d77783ea821d0b16b424 (patch)
treebae290aa1e69f095bf21667297de268b442931ba /sql/sp_head.cc
parentd5e1f6a632ac8cb5ccf7eecf0717290232c0c240 (diff)
downloadmariadb-git-3074beaad6bf259c6427d77783ea821d0b16b424.tar.gz
MDEV-17387 MariaDB Server giving wrong error while executing select query from procedure
Changing the way how a cursor is opened to fetch its structure only, e.g. for a cursor FOR loop record variable. The old methods with setting thd->lex->limit_rows_examined to an Item_uint(0) was not reliable and could push these messages into diagnostics area: The query examined at least 1 rows, which exceeds LIMIT ROWS EXAMINED (0) The new method should be more reliable, as it completely prevents the call of do_select() in JOIN::exec_inner() during the cursor structure discovery, so the execution of the cursor SELECT query returns immediately after the preparation step (when the result row structure becomes known), without even entering the code that fetches the result rows.
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r--sql/sp_head.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index c1c938dd9e7..c8b9576fe88 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -4470,9 +4470,9 @@ 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;
if (!(ret= tmp.export_structure(thd, &defs)))