Re: plpgsql: returning multiple named columns from function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: John Lawler <postgresql(dot)org(at)tgice(dot)com>
Cc: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: plpgsql: returning multiple named columns from function
Date: 2005-08-24 04:15:36
Message-ID: 21065.1124856936@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

John Lawler <postgresql(dot)org(at)tgice(dot)com> writes:
> Plus, the main part was to be able to have the columns (arbitrarily)
> named as if they'd been selected from a table. I hope that there's
> something about as easy as the example I cited from MS SQL.

In existing releases you need to create a named composite type (row
type) and declare the function as returning that type. PG 8.1 will
provide some syntactic sugar for this in the form of OUT parameters.
There are examples in the docs ...

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jim C. Nasby 2005-08-24 04:36:31 Re: ctid access is slow
Previous Message Jeff Eckermann 2005-08-24 03:56:02 Re: ctid access is slow