summaryrefslogtreecommitdiff
path: root/storage/federatedx
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2020-03-26 15:01:44 +0300
committerSergei Petrunia <psergey@askmonty.org>2020-03-26 15:01:44 +0300
commitaf4b2ae8588bd51cc17e66cfc8210c3225992fbe (patch)
tree3e05f500883c00f15f111bcfa7c96c4f2cf0d300 /storage/federatedx
parent1c8de231a3ea7ef2e08b1a5cfe17c37d733ea6ce (diff)
downloadmariadb-git-af4b2ae8588bd51cc17e66cfc8210c3225992fbe.tar.gz
MDEV-21887: federatedx crashes on SELECT ... INTO query in select_handler code
Backport to 10.4: - Don't try to push down SELECTs that have a side effect - In case the storage engine did support pushdown of SELECT with an INTO clause, write the rows we've got from it into select->join->result, and not thd->protocol. This way, SELECT ... INTO ... FROM smart_engine_table will put the result into where instructed, and NOT send it to the client.
Diffstat (limited to 'storage/federatedx')
-rw-r--r--storage/federatedx/federatedx_pushdown.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/storage/federatedx/federatedx_pushdown.cc b/storage/federatedx/federatedx_pushdown.cc
index 2bcee943308..15b0b0d3d4e 100644
--- a/storage/federatedx/federatedx_pushdown.cc
+++ b/storage/federatedx/federatedx_pushdown.cc
@@ -182,6 +182,16 @@ create_federatedx_select_handler(THD* thd, SELECT_LEX *sel)
return 0;
}
+ /*
+ Currently, ha_federatedx_select_handler::init_scan just takes the
+ thd->query and sends it to the backend.
+ This obviously won't work if the SELECT uses an "INTO @var" or
+ "INTO OUTFILE". It is also unlikely to work if the select has some
+ other kind of side effect.
+ */
+ if (sel->uncacheable & UNCACHEABLE_SIDEEFFECT)
+ return NULL;
+
handler= new ha_federatedx_select_handler(thd, sel);
return handler;
@@ -286,8 +296,9 @@ int ha_federatedx_select_handler::end_scan()
DBUG_RETURN(0);
}
-void ha_federatedx_select_handler::print_error(int, unsigned long)
+void ha_federatedx_select_handler::print_error(int error, myf error_flag)
{
+ select_handler::print_error(error, error_flag);
}