Subject: Aggrevating Aggregates

From: [email-masked]
Date: Fri, 2 Jul 1993 15:36:30 +22321159 (EDT)

Hi,

I've found an interesting problem.  I want to use a function
inside of an aggregate function.  Postgres says that this
is a syntax error.  If you cut at the line & execute this
in the monitor you'll see the syntax error at the bottom.

I'd really like to be able to use functions inside of 
the aggregate expressions... is there any hope for this?

---------------------- cut here -----------------------

remove aggregate sum \g

define aggregate sum (
	sfunc1 = int4inc, 
	sfunc2 = int4inc,
	finalfunc = int4inc, 
	initcond1 = "0",
	initcond2 = "-3") \g

destroy test \g

create test(age=int4) \g

append test(age=1) \g
append test(age=2) \g
append test(age=3) \g

retrieve (test.age) \g

retrieve (total = sum {test.age}) \g

retrieve (total = sum {int4add(test.age,3)}) \g

-------------------------- cut here ----------------------------

Query sent to backend is "retrieve (total = sum { int4add(test.age) }) "
WARN:Jul  2 15:28:26:parser: syntax error at or near "("

-- 
-----------------------------------------------------
"We're only immortal for a limited time..."

Bob Dugan	   [email-masked]  508-799-5150
Graduate Student   WPI CS Dept., Worcester, MA 01609
-----------------------------------------------------

---

From: [email-masked] (Paul M. Aoki)
Date: Sat, 03 Jul 93 00:39:06 -0700

[email-masked] writes:
> is a syntax error.

i don't know of any plans to clean up the (somewhat crocked) agg code 
in the near future.  (maybe marc has different ideas.)
--
  Paul M. Aoki  |  CS Div., Dept. of EECS, UCB  |  [email-masked]
                |  Berkeley, CA 94720           |  ...!uunet!ucbvax!aoki