diff --git a/enginetest/queries.go b/enginetest/queries.go index a5f177114e..490dfada7f 100644 --- a/enginetest/queries.go +++ b/enginetest/queries.go @@ -5656,6 +5656,15 @@ var BrokenQueries = []QueryTest{ Query: "SELECT 1 FROM DUAL WHERE (null, null) = (select null, null from dual)", Expected: []sql.Row{}, }, + // pushdownGroupByAliases breaks queries where subquery expressions + // reference the outer table and an alias gets pushed to a projection + // below a group by node. + { + Query: "SELECT c AS i_do_not_conflict, COUNT(*), MIN((SELECT COUNT(*) FROM (SELECT 1 AS d) b WHERE b.d = a.c)) FROM (SELECT 1 AS c) a GROUP BY i_do_not_conflict;", + }, + { + Query: "SELECT c AS c, COUNT(*), MIN((SELECT COUNT(*) FROM (SELECT 1 AS d) b WHERE b.d = a.c)) FROM (SELECT 1 AS c) a GROUP BY a.c;", + }, } var VersionedQueries = []QueryTest{