From: Tom Lane <tgl@sss.pgh.pa.us>
To: Roberto Mello <rmello@cc.usu.edu>
Cc: pgsql-sql@Postgresql.org
Subject: Re: Creating an aggregate function
Date: Sat, 09 Sep 2000 17:03:36 -0400
Message-ID: <29842.968533416@sss.pgh.pa.us> (raw)
In-Reply-To: <39B9EB44.43CD70B1@cc.usu.edu>
References: <39B9EB44.43CD70B1@cc.usu.edu>
Roberto Mello <rmello@cc.usu.edu> writes:
> and our output was:
> date_id | n_sessions_day | members | non_members
> ---------+----------------+-----------+-------------
> 1 | 500 | 30 | 136394044
> 2 | 2000 | 136394612 | 136394612
In current sources I get the expected results if I write the
CREATE AGGREGATE commands with
initcond1 = '0');
Although the parser will accept unquoted integers as initcond
inputs, it looks like something downstream is mishandling them,
resulting in an invalid initial value entered into the pg_aggregate
entry for the aggregate.
I'll look into fixing that for 7.1, but in the meantime try putting
quotes around the initial values.
BTW, your agg_if_member function is not very good, because if it gets
more than one input row with member_p = 1 then the result is order-
dependent. You don't want that.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, rmello@cc.usu.edu
Subject: Re: Creating an aggregate function
In-Reply-To: <29842.968533416@sss.pgh.pa.us>
References: <39B9EB44.43CD70B1@cc.usu.edu> <29842.968533416@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox