Re: A query that doesn't work on 7.1 - Mailing list pgsql-sql

From Tom Lane
Subject Re: A query that doesn't work on 7.1
Date
Msg-id 24466.984016499@sss.pgh.pa.us
Whole thread Raw
In response to Re: A query that doesn't work on 7.1  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
>> Here's a query that doesn't work on 7.1.  Is this a bug or am I doing
>> something wrong?

> Hmm, I think you have found some subtle bugs in aggregate processing;
> offhand it seems like both these queries should be legal.  I'll see what
> I can do about it.

Not so subtle after all :-(.  Curious that no one noticed this before.
Here's the patch if you need it right away...
        regards, tom lane


*** src/backend/optimizer/util/clauses.c.orig    Mon Feb 12 20:26:43 2001
--- src/backend/optimizer/util/clauses.c    Wed Mar  7 20:49:01 2001
***************
*** 540,545 ****
--- 540,553 ----                                          Query *context) {     if (node == NULL)
+         return false;
+ 
+     /*
+      * If we find an aggregate function, do not recurse into its
+      * arguments.  Subplans invoked within aggregate calls are allowed
+      * to receive ungrouped variables.
+      */
+     if (IsA(node, Aggref))         return false;      /*


pgsql-sql by date:

Previous
From: Roberto Mello
Date:
Subject: Re: quotes in pl/pgsql
Next
From: "guard"
Date:
Subject: postgresql beta-4,5 BUG