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

Commit77761ee

Browse files
committed
Remove incorrect Assert.
check_agglevels_and_constraints() asserted that if we find anaggregate function in an EXPR_KIND_FROM_SUBSELECT expression, theexpression must be in a LATERAL subquery. Alexander Lakhin found acase where that's not so: because of the odd scoping rules for NEW/OLDwithin a rule, a reference to NEW/OLD could cause an aggregate to beconsidered top-level even though it's in an unmarked sub-select.The error message that would be thrown seems sufficiently on-point,so just remove the Assert. (Hence, this is not a bug for productionbuilds.)This Assert was added by me in commiteaccfde (9.3 era). It lookslike I put it in to cross-check that the new logic for detectingmisplaced aggregates (using agglevelsup) caught the same cases that aprevious check on p_lateral_active did. So there might have been somerelated misbehavior beforeeaccfde ... but that's very ancienthistory by now, so I didn't dig any deeper.Per bug #18608 from Alexander Lakhin. Back-patch to all supportedbranches.Discussion:https://postgr.es/m/18608-48de0717508ee429@postgresql.org
1 parent2804233 commit77761ee

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

‎src/backend/parser/parse_agg.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,6 @@ check_agglevels_and_constraints(ParseState *pstate, Node *expr)
381381

382382
break;
383383
caseEXPR_KIND_FROM_SUBSELECT:
384-
/* Should only be possible in a LATERAL subquery */
385-
Assert(pstate->p_lateral_active);
386384

387385
/*
388386
* Aggregate/grouping scope rules make it worth being explicit

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp