Re: stateful UDF?

From: andrew <andrew(dot)ylzhou(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: stateful UDF?
Date: 2006-02-15 10:16:06
Message-ID: 29d3b0b90602150216u357c16dao81bd5f70ba9b391@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks. But it is a little different. What I want is one output value
of every input tuple. But the output value is not only based on the
current input value but also some value that have been read before.

On 2/15/06, Martijn van Oosterhout <kleptog(at)svana(dot)org> wrote:
> On Wed, Feb 15, 2006 at 10:49:14AM +0100, andrew wrote:
> > Within the same query. The function takes a tuple as its input
> > parameter. It will be used in the where clause. So I think it will be
> > called one time for each read tuple, right? I want to maintain a
> > structure to store the information about the tuples that have been
> > read so far. The output value of this function is computed based on
> > this information and the current input tuple.
>
> Sounds like you're referring to an aggregate which takes a number of
> input values and returns a single output value. There you define a
> state structure to deal with this.
>
> http://www.postgresql.org/docs/8.1/interactive/sql-createaggregate.html
>
> Hope this helps,
> --
> Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> > Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> > tool for doing 5% of the work and then sitting around waiting for someone
> > else to do the other 95% so you can sue them.
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (GNU/Linux)
>
> iD8DBQFD8vsEIB7bNG8LQkwRAkqEAJ97v7v9cUMWPXMcrc13ANVmLNfuYACggxty
> nRPGHR4KEPm0RUiwqGIdI7k=
> =nGrX
> -----END PGP SIGNATURE-----
>
>
>

--
andrew

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michelle Konzack 2006-02-15 10:49:59 Re: Debian Packages For PostgreSQL
Previous Message Martijn van Oosterhout 2006-02-15 09:57:24 Re: stateful UDF?