Skip to content

Commit 5288f55

Browse files
committed
Add test to cover group by alias with multiple alias columns
1 parent 484a87d commit 5288f55

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

sql/tests/test_select.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,14 @@ def test_select_group_by(self):
205205
'SELECT %s FROM "t" AS "a" GROUP BY %s')
206206
self.assertEqual(tuple(query.params), ('foo', 'foo'))
207207

208+
output1 = column.as_('c1')
209+
output2 = column.as_('c2')
210+
query = self.table.select(output1, output2, group_by=output2)
211+
self.assertEqual(str(query),
212+
'SELECT "a"."c" AS "c1", "a"."c" AS "c2" FROM "t" AS "a" '
213+
'GROUP BY 2')
214+
self.assertEqual(tuple(query.params), ())
215+
208216
def test_select_group_by_grouping_sets(self):
209217
query = self.table.select(
210218
Literal('*'),

0 commit comments

Comments
 (0)