From: | Alvaro Herrera <alvherre(at)commandprompt(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:55:44 |
Message-ID: | 20070822015544.GB12717@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Gregory Stark 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.
Any function declared as returning SETOF RECORD needs it, when you don't
use OUT params. Before OUT params existed, it was the only way to use
those functions.
--
Alvaro Herrera Valdivia, Chile ICBM: S 39º 49' 18.1", W 73º 13' 56.4"
"The eagle never lost so much time, as
when he submitted to learn of the crow." (William Blake)
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Broersma Jr | 2007-08-22 03:10:04 | Re: SELECT syntax synopsis: column_definition? |
Previous Message | Scott Marlowe | 2007-08-22 01:42:23 | Re: SELECT syntax synopsis: column_definition? |