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 14:02:06
Message-ID: 20030611070043.C90036-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:

> I'm interested to know what options there are in selecting values from a
> function returning a RECORD.
>
> For instance, in the query below:
>
> temporary=> SELECT
> *
> FROM
> fn_v1_board_view_board (1, 1)
> AS (n_id integer, t_description varchar, t_name varchar,
> typer integer, n_id_photo integer);
>
> it would be convenient to be able to omit some columns on occasion. Is
> this possible, as if the record returned was like a table.

You can use a list like n_id, t_description instead of * in the select I
believe just as usual.

> Also is it possible to ever truncate this sort of select as
>
> temporary=> SELECT
> *
> FROM
> fn_v1_board_view_board (1, 1);
>
> 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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2003-06-11 14:05:03 Re: Return Record with CASE problem
Previous Message Rory Campbell-Lange 2003-06-11 13:56:16 Options for select from function returning record?