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

Commit54204e6

Browse files
committed
Stick finger into a couple more holes in the leaky dike of
modifyAggrefQual. This routine really, really needs to be retired, butuntil we have subselects in FROM there's no chance of doing the job right.In the meantime try to respond to unhandlable cases with elog rather thancoredump.
1 parentfc43696 commit54204e6

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

‎src/backend/rewrite/rewriteHandler.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
*
88
* IDENTIFICATION
9-
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.58 1999/10/01 04:08:24 tgl Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.59 1999/10/02 04:42:04 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -530,6 +530,13 @@ modifyAggrefMakeSublink(Expr *origexp, Query *parsetree)
530530
subquery->targetList=lcons(tle,NIL);
531531
subquery->qual=modifyAggrefDropQual((Node*)parsetree->qual,
532532
(Node*)origexp);
533+
/*
534+
* If there are still aggs in the subselect's qual, give up.
535+
* Recursing would be a bad idea --- we'd likely produce an
536+
* infinite recursion. This whole technique is a crock, really...
537+
*/
538+
if (checkQueryHasAggs(subquery->qual))
539+
elog(ERROR,"Cannot handle aggregate function inserted at this place in WHERE clause");
533540
subquery->groupClause=NIL;
534541
subquery->havingQual=NULL;
535542
subquery->hasAggs= TRUE;
@@ -576,10 +583,18 @@ modifyAggrefQual(Node *node, Query *parsetree)
576583
SubLink*sub=modifyAggrefMakeSublink(expr,
577584
parsetree);
578585
parsetree->hasSubLinks= true;
586+
/* check for aggs in resulting lefthand... */
587+
sub->lefthand= (List*)modifyAggrefQual((Node*)sub->lefthand,
588+
parsetree);
579589
return (Node*)sub;
580590
}
581591
/* otherwise, fall through and copy the expr normally */
582592
}
593+
if (IsA(node,Aggref))
594+
{
595+
/* Oops, found one that's not inside an Expr we can rearrange... */
596+
elog(ERROR,"Cannot handle aggregate function inserted at this place in WHERE clause");
597+
}
583598
/* We do NOT recurse into subselects in this routine. It's sufficient
584599
* to get rid of aggregates that are in the qual expression proper.
585600
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp