File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -2181,6 +2181,7 @@ WHERE
21812181 },
21822182 {
21832183 // https://github.com/dolthub/dolt/issues/9782
2184+ // https://github.com/dolthub/dolt/issues/9973
21842185 name : "joining with subquery on empty table" ,
21852186 setup : [][]string {
21862187 {
@@ -2205,6 +2206,14 @@ WHERE
22052206 Query : "SELECT t.c FROM (SELECT t.c FROM t WHERE FALSE) AS subq NATURAL RIGHT JOIN t;" ,
22062207 Expected : []sql.Row {{1 }},
22072208 },
2209+ {
2210+ Query : "SELECT t.c FROM t FULL OUTER JOIN (SELECT t.c FROM t WHERE FALSE) AS subq ON TRUE;" ,
2211+ Expected : []sql.Row {{1 }},
2212+ },
2213+ {
2214+ Query : "SELECT t.c FROM (SELECT t.c FROM t WHERE FALSE) AS subq FULL OUTER JOIN t ON TRUE;" ,
2215+ Expected : []sql.Row {{1 }},
2216+ },
22082217 },
22092218 },
22102219 {
Original file line number Diff line number Diff line change @@ -79,10 +79,13 @@ func (b *Builder) isUsingJoin(te *ast.JoinTableExpr) bool {
7979}
8080
8181func (b * Builder ) canConvertToCrossJoin (te * ast.JoinTableExpr ) bool {
82- return ! strings .EqualFold (te .Join , ast .LeftJoinStr ) &&
83- ! strings .EqualFold (te .Join , ast .RightJoinStr ) &&
84- (te .Condition .On == nil || te .Condition .On == ast .BoolVal (true )) &&
85- te .Condition .Using == nil
82+ switch te .Join {
83+ case ast .LeftJoinStr , ast .RightJoinStr , ast .FullOuterJoinStr :
84+ return false
85+ default :
86+ return (te .Condition .On == nil || te .Condition .On == ast .BoolVal (true )) &&
87+ te .Condition .Using == nil
88+ }
8689}
8790
8891func (b * Builder ) buildJoin (inScope * scope , te * ast.JoinTableExpr ) (outScope * scope ) {
You can’t perform that action at this time.
0 commit comments