Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions enginetest/queries/script_queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -13371,6 +13371,20 @@ select * from t1 except (
},
},
},
{
// https://github.com/dolthub/dolt/issues/9951
Name: "Do not prune tables that are part of a semi-join",
SetUpScript: []string{
"create table t0(id int primary key, name longtext, description longtext, comment longtext, created_at timestamp(6), archived bool)",
"insert into t0 values (1, 'first', 'abc', 'def', '2025-10-14 10:00:00', b'0')",
},
Assertions: []ScriptTestAssertion{
{
Query: "select * from (select id, name, description, archived from t0 as test0 where (id in (select id from t0))) as dummy_alias order by dummy_alias.name asc;",
Expected: []sql.Row{{1, "first", "abc", 0}},
},
},
},
}

var SpatialScriptTests = []ScriptTest{
Expand Down
2 changes: 1 addition & 1 deletion sql/analyzer/symbol_resolution.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func pruneTables(ctx *sql.Context, a *Analyzer, n sql.Node, s *plan.Scope, sel R
case *plan.ResolvedTable:
return pruneTableCols(n, parentCols, parentStars, unqualifiedStar)
case *plan.JoinNode:
if n.JoinType().IsPhysical() || n.JoinType().IsUsing() {
if n.JoinType().IsPhysical() || n.JoinType().IsUsing() || n.JoinType().IsSemi() {
return n, transform.SameTree, nil
}
// we cannot push projections past lateral joins as columns not in the projection,
Expand Down