Can any one give an example of the difference between a column_alias and a
column_definition when
using a function in the FROM clause?
from the manual:
http://www.postgresql.org/docs/8.2/interactive/sql-select.html
function_name ( [ argument [, ...] ] ) [ AS ] alias [ ( column_alias [, ...] |
On Aug 21, 2007, at 14:34 , Richard Broersma Jr wrote:
Can any one give an example of the difference between a
column_alias and a column_definition when
using a function in the FROM clause?
from the manual:
http://www.postgresql.org/docs/8.2/interactive/sql-select.html
function_name ( [
On Aug 21, 2007, at 18:04 , Michael Glaesemann wrote:
So the *form* is right, but I don't know of an example that works.
CREATE TABLE foos
(
foo text PRIMARY KEY
, title text NOT NULL
);
INSERT INTO foos (foo, title) values
('foo', 'the great')
, ('bar', 'the extravagant')
, ('baz',
Michael Glaesemann [EMAIL PROTECTED] 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
On 8/21/07, Gregory Stark [EMAIL PROTECTED] wrote:
Michael Glaesemann [EMAIL PROTECTED] 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
Gregory Stark wrote:
Michael Glaesemann [EMAIL PROTECTED] 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'
--- Alvaro Herrera [EMAIL PROTECTED] wrote:
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.
Thanks everyone for the exposition! It makes sense.
Regards,
Richard Broersma Jr.
Gregory Stark [EMAIL PROTECTED] writes:
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.
IIRC, the case that actually convinced people to allow it was dblink.
You want to be able to do