Return-Path: pg_adm@postgres.berkeley.edu
Received: by postgres.Berkeley.EDU (5.61/1.29)
	id AA03508; Fri, 2 Jul 93 13:56:52 -0700
Message-Id: <9307022056.AA03508@postgres.Berkeley.EDU>
From: dugan@torg.wpi.edu
Subject: Aggrevating Aggregates
To: postgres@postgres.berkeley.edu
Sender: pg_adm@postgres.berkeley.edu
To: postgres@postgres.berkeley.edu
Date: Fri, 2 Jul 1993 15:36:30 +22321159 (EDT)
Cc: stdbms@cs.WPI.EDU
X-Mailer: ELM [version 2.4 PL0]
Content-Type: text
Content-Length: 1235      

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	   dugan@cs.wpi.edu  508-799-5150
Graduate Student   WPI CS Dept., Worcester, MA 01609
-----------------------------------------------------

