Skip to content

Commit 6d6b582

Browse files
committed
Disallow aggregate functions in rule WHERE clauses. Per gripe from
Fritz Lehmann-Grube back in January.
1 parent ea79457 commit 6d6b582

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/backend/parser/analyze.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.251 2002/10/14 22:14:35 tgl Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.252 2002/10/20 00:31:53 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -1454,6 +1454,10 @@ transformRuleStmt(ParseState *pstate, RuleStmt *stmt,
14541454
if (length(pstate->p_rtable) != 2) /* naughty, naughty... */
14551455
elog(ERROR, "Rule WHERE condition may not contain references to other relations");
14561456

1457+
/* aggregates not allowed (but subselects are okay) */
1458+
if (contain_agg_clause(stmt->whereClause))
1459+
elog(ERROR, "Rule WHERE condition may not contain aggregate functions");
1460+
14571461
/* save info about sublinks in where clause */
14581462
qry->hasSubLinks = pstate->p_hasSubLinks;
14591463

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