summaryrefslogtreecommitdiff
path: root/sql/sql_delete.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2022-12-28 05:41:41 +0200
committerMonty <monty@mariadb.org>2023-02-10 12:58:50 +0200
commit9a4110aa5799d63faced5f986fab9035785a9310 (patch)
tree088a18218346042fb60a8b37bf2d2da365e17924 /sql/sql_delete.cc
parente3f56254a8f6e03270b73fb9f6fd1aaab1141590 (diff)
downloadmariadb-git-9a4110aa5799d63faced5f986fab9035785a9310.tar.gz
MDEV-30256 Wrong result (missing rows) upon join with empty table
The problem was an assignment in test_quick_select() that flagged empty tables with "Impossible where". This test was however wrong as it didn't work correctly for left join. Removed the test, but added checking of empty tables in DELETE and UPDATE to get similar EXPLAIN as before. The new tests is a bit more strict (better) than before as it catches all cases of empty tables in single table DELETE/UPDATE.
Diffstat (limited to 'sql/sql_delete.cc')
-rw-r--r--sql/sql_delete.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index d31d0b949ba..0c0f05aab07 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -526,7 +526,9 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
select=make_select(table, 0, 0, conds, (SORT_INFO*) 0, 0, &error);
if (unlikely(error))
DBUG_RETURN(TRUE);
- if ((select && select->check_quick(thd, safe_update, limit)) || !limit)
+ if (unlikely((select && select->check_quick(thd, safe_update, limit)) ||
+ table->stat_records() == 0 ||
+ !limit))
{
query_plan.set_impossible_where();
if (thd->lex->describe || thd->lex->analyze_stmt)