@@ -9352,6 +9352,20 @@ from typestable`,
9352
9352
{"0" }, {"1" }, {"0" }, {"1" },
9353
9353
},
9354
9354
},
9355
+ // https://github.com/dolthub/dolt/issues/7095
9356
+ // References in group by and having should be allowed to match select aliases
9357
+ {
9358
+ Query : "select y as z from xy group by (y) having AVG(z) > 0" ,
9359
+ Expected : []sql.Row {{1 }, {2 }, {3 }},
9360
+ },
9361
+ {
9362
+ Query : "select y as z from xy group by (z) having AVG(z) > 0" ,
9363
+ Expected : []sql.Row {{1 }, {2 }, {3 }},
9364
+ },
9365
+ {
9366
+ Query : "select y + 1 as z from xy group by (z) having AVG(z) > 1" ,
9367
+ Expected : []sql.Row {{2 }, {3 }, {4 }},
9368
+ },
9355
9369
}
9356
9370
9357
9371
var KeylessQueries = []QueryTest {
@@ -9603,20 +9617,6 @@ FROM mytable;`,
9603
9617
{"DECIMAL" },
9604
9618
},
9605
9619
},
9606
- // https://github.com/dolthub/dolt/issues/7095
9607
- // References in group by and having should be allowed to match select aliases
9608
- {
9609
- Query : "select y as z from xy group by (y) having AVG(z) > 0" ,
9610
- Expected : []sql.Row {{1 }, {2 }, {3 }},
9611
- },
9612
- {
9613
- Query : "select y as z from xy group by (z) having AVG(z) > 0" ,
9614
- Expected : []sql.Row {{1 }, {2 }, {3 }},
9615
- },
9616
- {
9617
- Query : "select y + 1 as z from xy group by (z) having AVG(z) > 1" ,
9618
- Expected : []sql.Row {{2 }, {3 }, {4 }},
9619
- },
9620
9620
}
9621
9621
9622
9622
var VersionedQueries = []QueryTest {
0 commit comments