@@ -348,7 +348,7 @@ SELECT gender g, MAX(emp_no) m FROM "test_emp" GROUP BY g HAVING MAX(emp_no) > 1
348
348
aggMaxWithHavingOnAlias
349
349
SELECT gender g, MAX(emp_no) m FROM "test_emp" GROUP BY g HAVING m > 10 ORDER BY g ;
350
350
aggMaxWithMultipleHaving
351
- SELECT gender g, MAX(emp_no) m FROM "test_emp" GROUP BY g HAVING m > 10 AND m < 99999 ORDER BY gender;
351
+ SELECT gender g, MAX(emp_no) m FROM "test_emp" GROUP BY g HAVING m > 10 AND m < 99999 ORDER BY gender;
352
352
aggMaxWithMultipleHavingBetween
353
353
SELECT gender g, MAX(emp_no) m FROM "test_emp" GROUP BY g HAVING m BETWEEN 10 AND 99999 ORDER BY g ;
354
354
aggMaxWithMultipleHavingWithLimit
@@ -435,7 +435,7 @@ SELECT 1 FROM test_emp HAVING COUNT(*) > 0;
435
435
implicitGroupingWithLiteralAliasAndFiltering
436
436
SELECT 1 AS l FROM test_emp HAVING COUNT(*) > 0;
437
437
implicitGroupingWithLiteralAndFilteringOnAlias
438
- SELECT 1, COUNT(*) AS c FROM test_emp HAVING c > 0;
438
+ SELECT 1, COUNT(*) AS c FROM test_emp HAVING c > 0;
439
439
implicitGroupingWithLiteralAliasAndFilteringOnAlias
440
440
SELECT 1 AS l FROM test_emp HAVING COUNT(*) > 0;
441
441
implicitGroupingWithAggs
@@ -497,7 +497,7 @@ SELECT MIN(salary) mi, MAX(salary) ma, MAX(salary) - MIN(salary) AS d FROM test_
497
497
498
498
499
499
//
500
- // Mixture of aggs that get promoted plus filtering on one of them
500
+ // Mixture of aggs that get promoted plus filtering on one of them
501
501
//
502
502
aggMultiWithHaving
503
503
SELECT MIN(salary) min, MAX(salary) max, gender g, COUNT(*) c FROM "test_emp" WHERE languages > 0 GROUP BY g HAVING max > 74600 ORDER BY gender;
@@ -565,3 +565,45 @@ implicitGroupByWithLiteral
565
565
SELECT 10, MAX("salary") FROM test_emp;
566
566
groupByWithLiteralAndCount
567
567
SELECT 20, COUNT(*) from test_emp GROUP BY gender ORDER BY 2;
568
+ groupByNumberWithLiteral
569
+ SELECT emp_no e, 5 FROM "test_emp" GROUP BY emp_no ORDER BY e DESC;
570
+ groupByNumberWithWhereWithLiteral
571
+ SELECT emp_no e, 5 FROM "test_emp" WHERE emp_no < 10020 GROUP BY e ORDER BY emp_no DESC;
572
+ groupByMulScalarWithLiterals
573
+ SELECT emp_no * 2 AS e , 5, TRUE FROM test_emp GROUP BY e ORDER BY e;
574
+ groupByMulScalarWithWhereWithLiterals
575
+ SELECT emp_no * 2 AS e, 5, TRUE FROM test_emp WHERE emp_no < 10020 GROUP BY e ORDER BY e;
576
+ aggMaxImplicitWithLiteral
577
+ SELECT MAX(salary) AS max, 5 FROM test_emp;
578
+ aggMaxImplicitWithCastWithLiteral
579
+ SELECT CAST(MAX(emp_no) AS SMALLINT) c, 5 FROM "test_emp";
580
+ aggMaxImplicitWithCastWithWhereWithLiteral
581
+ SELECT CAST(MAX(emp_no) AS SMALLINT) c, 5 FROM "test_emp" WHERE emp_no > 10000;
582
+ aggSumWithCastWithLiteral
583
+ SELECT gender g, CAST(SUM(emp_no) AS BIGINT) s, TRUE FROM "test_emp" GROUP BY gender ORDER BY gender;
584
+ aggSumWithCastWithAliasWithLiteral
585
+ SELECT TRUE, gender g, CAST(SUM(emp_no) AS BIGINT) s FROM "test_emp" GROUP BY g ORDER BY g DESC;
586
+ aggSumWithWhereWithLiteral
587
+ SELECT TRUE, gender g, CAST(SUM(emp_no) AS BIGINT) s FROM "test_emp" WHERE emp_no > 10000 GROUP BY gender ORDER BY gender;
588
+
589
+ // group by with aliased literal
590
+ groupByNumberWithLiteralWithAlias
591
+ SELECT emp_no e, 5 department FROM "test_emp" GROUP BY emp_no ORDER BY e DESC;
592
+ groupByNumberWithWhereWithLiteralWithAlias
593
+ SELECT emp_no e, 5 department FROM "test_emp" WHERE emp_no < 10020 GROUP BY e ORDER BY emp_no DESC;
594
+ groupByMulScalarWithLiteralsWithAliases
595
+ SELECT emp_no * 2 AS e, 5 department, TRUE as employed FROM test_emp GROUP BY e ORDER BY e;
596
+ groupByMulScalarWithWhereWithLiteralsWithAliases
597
+ SELECT emp_no * 2 AS e, 5 department, TRUE as employed FROM test_emp WHERE emp_no < 10020 GROUP BY e ORDER BY e;
598
+ aggMaxImplicitWithLiteralWithAlias
599
+ SELECT MAX(salary) AS max, 5 department FROM test_emp;
600
+ aggMaxImplicitWithCastWithLiteralWithAlias
601
+ SELECT CAST(MAX(emp_no) AS SMALLINT) c, 5 department FROM "test_emp";
602
+ aggMaxImplicitWithCastWithWhereWithLiteralWithAlias
603
+ SELECT CAST(MAX(emp_no) AS SMALLINT) c, 5 department FROM "test_emp" WHERE emp_no > 10000;
604
+ aggSumWithCastWithLiteralWithAlias
605
+ SELECT gender g, CAST(SUM(emp_no) AS BIGINT) s, TRUE as employed FROM "test_emp" GROUP BY gender ORDER BY gender;
606
+ aggSumWithCastWithAliasWithLiteralWithAlias
607
+ SELECT TRUE as employed, gender g, CAST(SUM(emp_no) AS BIGINT) s FROM "test_emp" GROUP BY g ORDER BY g DESC;
608
+ aggSumWithWhereWithLiteralWithAlias
609
+ SELECT TRUE as employed, gender g, CAST(SUM(emp_no) AS BIGINT) s FROM "test_emp" WHERE emp_no > 10000 GROUP BY gender ORDER BY gender;
0 commit comments