Skip to content

Commit b7ffa4a

Browse files
committed
added tests
1 parent 415ee2c commit b7ffa4a

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

enginetest/queries/queries.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9374,6 +9374,24 @@ from typestable`,
93749374
Query: "select c1, c2 from one_pk where c2 = 1 group by c1",
93759375
Expected: []sql.Row{{0, 1}},
93769376
},
9377+
// https://github.com/dolthub/dolt/issues/9699
9378+
// Correlated columns in subqueries are included in select dependencies
9379+
{
9380+
Query: "select any_value(pk), (select max(pk) from one_pk where pk < opk.pk) as x from one_pk opk",
9381+
Expected: []sql.Row{{0, nil}, {1, 0}, {2, 1}, {3, 2}},
9382+
},
9383+
{
9384+
Query: "SELECT any_value(pk), (SELECT max(pk) FROM one_pk WHERE pk < opk.pk) AS x FROM one_pk opk WHERE (SELECT max(pk) FROM one_pk WHERE pk < opk.pk) > 0;",
9385+
Expected: []sql.Row{{2, 1}, {3, 2}},
9386+
},
9387+
{
9388+
Query: "select any_value(pk), (select max(pk) from one_pk where pk < (opk.c1 - 10)) as x from one_pk opk",
9389+
Expected: []sql.Row{{0, nil}, {1, nil}, {2, 3}, {3, 3}},
9390+
},
9391+
{
9392+
Query: "select pk, (select max(pk) from one_pk where pk < opk.pk) as x from one_pk opk",
9393+
Expected: []sql.Row{{0, nil}, {1, 0}, {2, 1}, {3, 2}},
9394+
},
93779395
}
93789396

93799397
var KeylessQueries = []QueryTest{

0 commit comments

Comments
 (0)