Skip to content

Commit 0c4929f

Browse files
committed
Parser no longer considers
SELECT a/2, a/2 FROM test_missing_target GROUP BY a/2; to be ambiguous ... which I think is correct behavior.
1 parent 7f76eab commit 0c4929f

File tree

2 files changed

+25
-26
lines changed

2 files changed

+25
-26
lines changed

src/test/regress/expected/select_implicit.out

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,15 @@ QUERY: SELECT a/2, a/2 FROM test_missing_target
133133

134134
QUERY: SELECT a/2, a/2 FROM test_missing_target
135135
GROUP BY a/2;
136-
ERROR: GROUP BY has ambiguous expression
136+
?column?|?column?
137+
--------+--------
138+
0| 0
139+
1| 1
140+
2| 2
141+
3| 3
142+
4| 4
143+
(5 rows)
144+
137145
QUERY: SELECT x.b, count(*) FROM test_missing_target x, test_missing_target y
138146
WHERE x.a = y.a
139147
GROUP BY x.b;
@@ -169,19 +177,14 @@ count
169177
4
170178
(4 rows)
171179

172-
QUERY: SELECT a%2, count(a) FROM test_missing_target GROUP BY test_missing_target.a%2;
180+
QUERY: SELECT a%2, count(b) FROM test_missing_target GROUP BY test_missing_target.a%2;
173181
?column?|count
174182
--------+-----
175183
0| 5
176184
1| 5
177185
(2 rows)
178186

179-
QUERY: /*
180-
NOTE: as of 1998-08-01 a bug was detected unrelated to this feature which
181-
requires the aggragate function argument to be the same as some non-agragate
182-
in the target list. (i.e. count(*) and count(b) crash the backend.)
183-
*/
184-
SELECT count(c) FROM test_missing_target GROUP BY lower(test_missing_target.c);
187+
QUERY: SELECT count(c) FROM test_missing_target GROUP BY lower(test_missing_target.c);
185188
count
186189
-----
187190
2

src/test/regress/sql/select_implicit.sql

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,38 +53,38 @@ SELECT c, count(*) FROM test_missing_target GROUP BY 1;
5353
-- failure expected
5454
SELECT c, count(*) FROM test_missing_target GROUP BY 3;
5555

56-
-- group w/o existing GROUP BY and ORDER BY target under ambigious condition
56+
-- group w/o existing GROUP BY and ORDER BY target under ambiguous condition
5757
-- failure expected
5858
SELECT count(*) FROM test_missing_target x, test_missing_target y
5959
WHERE x.a = y.a
6060
GROUP BY b ORDER BY b;
6161

62-
-- order w/ target under ambigious condition
62+
-- order w/ target under ambiguous condition
6363
-- failure NOT expected
6464
SELECT a, a FROM test_missing_target
6565
ORDER BY a;
6666

67-
-- order expression w/ target under ambigious condition
67+
-- order expression w/ target under ambiguous condition
6868
-- failure NOT expected
6969
SELECT a/2, a/2 FROM test_missing_target
7070
ORDER BY a/2;
7171

72-
-- group expression w/ target under ambigious condition
73-
-- failure expected
72+
-- group expression w/ target under ambiguous condition
73+
-- failure NOT expected
7474
SELECT a/2, a/2 FROM test_missing_target
7575
GROUP BY a/2;
7676

77-
-- group w/ existing GROUP BY target under ambigious condition
77+
-- group w/ existing GROUP BY target under ambiguous condition
7878
SELECT x.b, count(*) FROM test_missing_target x, test_missing_target y
7979
WHERE x.a = y.a
8080
GROUP BY x.b;
8181

82-
-- group w/o existing GROUP BY target under ambigious condition
82+
-- group w/o existing GROUP BY target under ambiguous condition
8383
SELECT count(*) FROM test_missing_target x, test_missing_target y
8484
WHERE x.a = y.a
8585
GROUP BY x.b;
8686

87-
-- group w/o existing GROUP BY target under ambigious condition
87+
-- group w/o existing GROUP BY target under ambiguous condition
8888
-- into a table
8989
SELECT count(*) INTO TABLE test_missing_target2
9090
FROM test_missing_target x, test_missing_target y
@@ -96,12 +96,7 @@ SELECT * FROM test_missing_target2;
9696
-- Functions and expressions
9797

9898
-- w/ existing GROUP BY target
99-
SELECT a%2, count(a) FROM test_missing_target GROUP BY test_missing_target.a%2;
100-
/*
101-
NOTE: as of 1998-08-01 a bug was detected unrelated to this feature which
102-
requires the aggragate function argument to be the same as some non-agragate
103-
in the target list. (i.e. count(*) and count(b) crash the backend.)
104-
*/
99+
SELECT a%2, count(b) FROM test_missing_target GROUP BY test_missing_target.a%2;
105100

106101
-- w/o existing GROUP BY target using a relation name in GROUP BY clause
107102
SELECT count(c) FROM test_missing_target GROUP BY lower(test_missing_target.c);
@@ -124,23 +119,24 @@ SELECT a FROM test_missing_target ORDER BY upper(d);
124119
SELECT count(b) FROM test_missing_target
125120
GROUP BY (b + 1) / 2 ORDER BY (b + 1) / 2 desc;
126121

127-
-- group w/o existing GROUP BY and ORDER BY target under ambigious condition
122+
-- group w/o existing GROUP BY and ORDER BY target under ambiguous condition
128123
-- failure expected
129124
SELECT count(x.a) FROM test_missing_target x, test_missing_target y
130125
WHERE x.a = y.a
131126
GROUP BY b/2 ORDER BY b/2;
132127

133-
-- group w/ existing GROUP BY target under ambigious condition
128+
-- group w/ existing GROUP BY target under ambiguous condition
134129
SELECT x.b/2, count(x.b) FROM test_missing_target x, test_missing_target y
135130
WHERE x.a = y.a
136131
GROUP BY x.b/2;
137132

138-
-- group w/o existing GROUP BY target under ambigious condition
133+
-- group w/o existing GROUP BY target under ambiguous condition
134+
-- failure expected due to ambiguous b in count(b)
139135
SELECT count(b) FROM test_missing_target x, test_missing_target y
140136
WHERE x.a = y.a
141137
GROUP BY x.b/2;
142138

143-
-- group w/o existing GROUP BY target under ambigious condition
139+
-- group w/o existing GROUP BY target under ambiguous condition
144140
-- into a table
145141
SELECT count(x.b) INTO TABLE test_missing_target3
146142
FROM test_missing_target x, test_missing_target y

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy