Re: SELECT syntax synopsis: column_definition?

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Gregory Stark" <stark(at)enterprisedb(dot)com>
Cc: "Michael Glaesemann" <grzm(at)seespotcode(dot)net>, "Richard Broersma Jr" <rabroersma(at)yahoo(dot)com>, "SQL Postgresql List" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: SELECT syntax synopsis: column_definition?
Date: 2007-08-22 01:42:23
Message-ID: dcc563d10708211842k365e15ccy631e4c43b98da996@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 8/21/07, Gregory Stark <stark(at)enterprisedb(dot)com> wrote:
> "Michael Glaesemann" <grzm(at)seespotcode(dot)net> writes:
>
> > ERROR: a column definition list is only allowed for functions returning
> > "record"
> >
> > So the *form* is right, but I don't know of an example that works.
>
> postgres=# create function testf() returns record as 'select 1' language sql;
> CREATE FUNCTION
> postgres=# select * from testf() as (i integer);
> i
> ---
> 1
> (1 row)
>
>
> I haven't quite figured out how this is useful though. It probably makes more
> sense if you use plpgsql but I still don't quite see what the use case is.

I use them with the crosstab function in the tablefunc contrib module.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Alvaro Herrera 2007-08-22 01:55:44 Re: SELECT syntax synopsis: column_definition?
Previous Message Gregory Stark 2007-08-21 23:53:21 Re: SELECT syntax synopsis: column_definition?