Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0c4929f

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 parent7f76eab commit0c4929f

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_targetGROUP BY3;
5555

56-
-- group w/o existing GROUP BY and ORDER BY target underambigious condition
56+
-- group w/o existing GROUP BY and ORDER BY target underambiguous condition
5757
-- failure expected
5858
SELECTcount(*)FROM test_missing_target x, test_missing_target y
5959
WHEREx.a=y.a
6060
GROUP BY bORDER BY b;
6161

62-
-- order w/ target underambigious condition
62+
-- order w/ target underambiguous condition
6363
-- failure NOT expected
6464
SELECT a, aFROM test_missing_target
6565
ORDER BY a;
6666

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

72-
-- group expression w/ target underambigious condition
73-
-- failure expected
72+
-- group expression w/ target underambiguous condition
73+
-- failureNOTexpected
7474
SELECT a/2, a/2FROM test_missing_target
7575
GROUP BY a/2;
7676

77-
-- group w/ existing GROUP BY target underambigious condition
77+
-- group w/ existing GROUP BY target underambiguous condition
7878
SELECTx.b,count(*)FROM test_missing_target x, test_missing_target y
7979
WHEREx.a=y.a
8080
GROUP BYx.b;
8181

82-
-- group w/o existing GROUP BY target underambigious condition
82+
-- group w/o existing GROUP BY target underambiguous condition
8383
SELECTcount(*)FROM test_missing_target x, test_missing_target y
8484
WHEREx.a=y.a
8585
GROUP BYx.b;
8686

87-
-- group w/o existing GROUP BY target underambigious condition
87+
-- group w/o existing GROUP BY target underambiguous condition
8888
-- into a table
8989
SELECTcount(*) 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_targetGROUP BYtest_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_targetGROUP BYtest_missing_target.a%2;
105100

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

127-
-- group w/o existing GROUP BY and ORDER BY target underambigious condition
122+
-- group w/o existing GROUP BY and ORDER BY target underambiguous condition
128123
-- failure expected
129124
SELECTcount(x.a)FROM test_missing_target x, test_missing_target y
130125
WHEREx.a=y.a
131126
GROUP BY b/2ORDER BY b/2;
132127

133-
-- group w/ existing GROUP BY target underambigious condition
128+
-- group w/ existing GROUP BY target underambiguous condition
134129
SELECTx.b/2,count(x.b)FROM test_missing_target x, test_missing_target y
135130
WHEREx.a=y.a
136131
GROUP BYx.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
SELECTcount(b)FROM test_missing_target x, test_missing_target y
140136
WHEREx.a=y.a
141137
GROUP BYx.b/2;
142138

143-
-- group w/o existing GROUP BY target underambigious condition
139+
-- group w/o existing GROUP BY target underambiguous condition
144140
-- into a table
145141
SELECTcount(x.b) INTO TABLE test_missing_target3
146142
FROM test_missing_target x, test_missing_target y

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp