Re: Options for select from function returning record?

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Rory Campbell-Lange <rory(at)campbell-lange(dot)net>
Cc: Postgresql General List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Options for select from function returning record?
Date: 2003-06-11 16:26:45
Message-ID: 20030611092407.L93562-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Wed, 11 Jun 2003, Rory Campbell-Lange wrote:

> On 11/06/03, Stephan Szabo (sszabo(at)megazone23(dot)bigpanda(dot)com) wrote:
> >
> > On Wed, 11 Jun 2003, Rory Campbell-Lange wrote:
> >
> > > Also is it possible to ever truncate this sort of select as
> ...
> > > ommitting the "AS"?
> >
> > Not for a function returning records currently. If the type is known and
> > constant, you can instead make a composite type with CREATE TYPE AS and
> > have the function return those rather than record.
>
> I thought that making a type makes the query simpler (for the client
> application). The example below uses the %rowtype row variable type (and
> works!). Is this a recommended approach?

Right now, I'd suggest it for any case where the result definition would
be known at function creation time rather than only at call time (for
example, this wouldn't make sense for dblink).

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2003-06-11 16:27:59 Re: Return Record with CASE problem
Previous Message Bruce Momjian 2003-06-11 16:24:17 Re: [HACKERS] SAP and MySQL ... [and Benchmark]