Repository navigation
MDEV-41862: Syntax error with DELETE and IN in FederatedX pushdown - #6050
Open
bsrikanth-mariadb wants to merge 1 commit into
Conversation
Contributor
Author
|
Moved the suggested changes from #6036 to here (as the main merge created a lot of merge conflicts) |
A single-table DELETE with an IN subquery on the same table, pushed down to FederatedX, failed on the remote server with a syntax error: DELETE FROM t3 WHERE a IN (SELECT a FROM t3 WHERE a < 3); The target table of a single-table DELETE is not in top_join_list, so the list is empty. st_select_lex::print() printed it as "delete from using dual where ...". Fix: in st_select_lex::print() use top_join_list only when it is not empty, and otherwise print the tables from leaf_tables. For DELETE that branch emits the "from " keyword. UPDATE is unchanged. As a side effect, EXPLAIN EXTENDED of a single-table DELETE no longer shows the dummy "using dual" and prints "delete from `t` where ...". A DELETE through a view now prints the view instead of its base table. Update the affected results (explain_non_select, myisam_explain_non_select_all, opt_hints, opt_hints_index, opt_trace, versioning.delete_history). Add a test to federatedx_pushdown_upd_del that pushes down DELETE (also with ORDER BY ... LIMIT and as a prepared statement) and UPDATE with an IN subquery on the same table, and checks both the resulting data and the statements received by the remote server in its general log.
spetrunia
force-pushed
the
13.2-MDEV-41862-syntax-err-with-delete-and-in-op-when-pushdown-1
branch
from
November 2, 2026 11:40
b9b5449 to
746a3d1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A single-table DELETE with an IN subquery on the same table, pushed down to FederatedX, failed on the remote server with a syntax error:
DELETE FROM t3 WHERE a IN (SELECT a FROM t3 WHERE a < 3);
The target table of a single-table DELETE is not in top_join_list, so the list is empty. st_select_lex::print() printed it as "delete from using dual where ...".
Fix: in st_select_lex::print() use top_join_list only when it is not empty, and otherwise print the tables from leaf_tables. For DELETE that branch emits the "from " keyword. UPDATE is unchanged.
As a side effect, EXPLAIN EXTENDED of a single-table DELETE no longer shows the dummy "using dual" and prints "delete from
twhere ...". A DELETE through a view now prints the view instead of its base table. Update the affected results (explain_non_select,myisam_explain_non_select_all, opt_hints, opt_hints_index, opt_trace, versioning.delete_history).
Add a test to federatedx_pushdown_upd_del that pushes down DELETE (also with ORDER BY ... LIMIT and as a prepared statement) and UPDATE with an IN subquery on the same table, and checks both the resulting data and the statements received by the remote server in its general log.