Re: 8.1 OUT params returning more than one row question

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Tony Caduto <tony_caduto(at)amsoftwaredesign(dot)com>
Cc: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: 8.1 OUT params returning more than one row question
Date: 2005-08-31 17:09:20
Message-ID: 20050831170920.GB11228@surnet.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Aug 31, 2005 at 11:27:39AM -0500, Tony Caduto wrote:

Hi,

> I came up with the function below, and it does work, however I had to
> declare another record to use in the FOR ..IN loop.
>
> From my reading of the docs the out params create a record type
> automaticly and my question is how can I use this automaticly created
> record in the FOR loop? It does not seem right that I have to create
> another record type and then copy the row values to the out parms.

The record that you are not supposed to declare is the output record,
i.e. you don't have to use CREATE TYPE, use a table type, or describe
the anonymous record in the SELECT statement. Of course, in PL/pgSQL
you need a variable to do the FOR ... LOOP.

Your example works fine for me. What exactly were you expecting?

--
Alvaro Herrera -- Valdivia, Chile Architect, www.EnterpriseDB.com
"Escucha y olvidarás; ve y recordarás; haz y entenderás" (Confucio)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tony Caduto 2005-08-31 17:31:01 Re: 8.1 and syntax checking at create time
Previous Message Alvaro Herrera 2005-08-31 17:04:27 Re: 8.1 and syntax checking at create time