summaryrefslogtreecommitdiff
path: root/sql/sql_delete.cc
diff options
context:
space:
mode:
authorDaniel Ye <35718816+GreaTdANie1@users.noreply.github.com>2021-09-22 17:55:05 +0800
committerGitHub <noreply@github.com>2021-09-22 18:55:05 +0900
commit9fc1ef932f0b7499724cfcf76bd0f298f135018f (patch)
tree75545537126fdf6a3639cc10fcbe8bff86487611 /sql/sql_delete.cc
parent3d30458695ed9c8acf8d33b447e4b18844f2988b (diff)
downloadmariadb-git-9fc1ef932f0b7499724cfcf76bd0f298f135018f.tar.gz
MDEV-26545 Spider does not correctly handle UDF and stored function in where conds
- Handle stored function conditions correctly, with the same logic as with UDFs. - When running queries on Spider SE, by default, we do not push down WHERE conditions containing usage of UDFs/stored functions to remote data nodes, unless the user demands (by setting spider_use_pushdown_udf). - Disable direct update/delete when a udf condition is skipped.
Diffstat (limited to 'sql/sql_delete.cc')
-rw-r--r--sql/sql_delete.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 084b5a76b84..f6c05da9445 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -583,14 +583,18 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
if (!table->check_virtual_columns_marked_for_read())
{
DBUG_PRINT("info", ("Trying direct delete"));
- if (select && select->cond &&
- (select->cond->used_tables() == table->map))
+ bool use_direct_delete= !select || !select->cond;
+ if (!use_direct_delete &&
+ (select->cond->used_tables() & ~RAND_TABLE_BIT) == table->map)
{
DBUG_ASSERT(!table->file->pushed_cond);
if (!table->file->cond_push(select->cond))
+ {
+ use_direct_delete= TRUE;
table->file->pushed_cond= select->cond;
+ }
}
- if (!table->file->direct_delete_rows_init())
+ if (use_direct_delete && !table->file->direct_delete_rows_init())
{
/* Direct deleting is supported */
DBUG_PRINT("info", ("Using direct delete"));