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

Commitcb7c84f

Browse files
committed
Check misplaced window functions before checking aggregate/group by sanity.
If somebody puts a window function in WHERE, we should complain about thatin so many words. The previous coding tended to complain about the windowfunction's arguments instead, which is likely to be misleading to users whoare unclear on the semantics of window functions; as seen for example inbug #6440 from Matyas Novak.Just another example of how "add new code at the end" is frequently a badheuristic.
1 parentcbba55d commitcb7c84f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

‎src/backend/parser/analyze.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -316,12 +316,12 @@ transformDeleteStmt(ParseState *pstate, DeleteStmt *stmt)
316316
qry->jointree=makeFromExpr(pstate->p_joinlist,qual);
317317

318318
qry->hasSubLinks=pstate->p_hasSubLinks;
319-
qry->hasAggs=pstate->p_hasAggs;
320-
if (pstate->p_hasAggs)
321-
parseCheckAggregates(pstate,qry);
322319
qry->hasWindowFuncs=pstate->p_hasWindowFuncs;
323320
if (pstate->p_hasWindowFuncs)
324321
parseCheckWindowFuncs(pstate,qry);
322+
qry->hasAggs=pstate->p_hasAggs;
323+
if (pstate->p_hasAggs)
324+
parseCheckAggregates(pstate,qry);
325325

326326
assign_query_collations(pstate,qry);
327327

@@ -970,12 +970,12 @@ transformSelectStmt(ParseState *pstate, SelectStmt *stmt)
970970
qry->jointree=makeFromExpr(pstate->p_joinlist,qual);
971971

972972
qry->hasSubLinks=pstate->p_hasSubLinks;
973-
qry->hasAggs=pstate->p_hasAggs;
974-
if (pstate->p_hasAggs||qry->groupClause||qry->havingQual)
975-
parseCheckAggregates(pstate,qry);
976973
qry->hasWindowFuncs=pstate->p_hasWindowFuncs;
977974
if (pstate->p_hasWindowFuncs)
978975
parseCheckWindowFuncs(pstate,qry);
976+
qry->hasAggs=pstate->p_hasAggs;
977+
if (pstate->p_hasAggs||qry->groupClause||qry->havingQual)
978+
parseCheckAggregates(pstate,qry);
979979

980980
foreach(l,stmt->lockingClause)
981981
{
@@ -1448,12 +1448,12 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
14481448
qry->jointree=makeFromExpr(pstate->p_joinlist,NULL);
14491449

14501450
qry->hasSubLinks=pstate->p_hasSubLinks;
1451-
qry->hasAggs=pstate->p_hasAggs;
1452-
if (pstate->p_hasAggs||qry->groupClause||qry->havingQual)
1453-
parseCheckAggregates(pstate,qry);
14541451
qry->hasWindowFuncs=pstate->p_hasWindowFuncs;
14551452
if (pstate->p_hasWindowFuncs)
14561453
parseCheckWindowFuncs(pstate,qry);
1454+
qry->hasAggs=pstate->p_hasAggs;
1455+
if (pstate->p_hasAggs||qry->groupClause||qry->havingQual)
1456+
parseCheckAggregates(pstate,qry);
14571457

14581458
foreach(l,lockingClause)
14591459
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp