[SQL] SELECT syntax synopsis: column_definition?

2007-08-21 Thread Richard Broersma Jr
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 [, ...] |

Re: [SQL] SELECT syntax synopsis: column_definition?

2007-08-21 Thread Michael Glaesemann
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 ( [

Re: [SQL] SELECT syntax synopsis: column_definition?

2007-08-21 Thread Michael Glaesemann
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',

Re: [SQL] SELECT syntax synopsis: column_definition?

2007-08-21 Thread Gregory Stark
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

Re: [SQL] SELECT syntax synopsis: column_definition?

2007-08-21 Thread Scott Marlowe
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

Re: [SQL] SELECT syntax synopsis: column_definition?

2007-08-21 Thread Alvaro Herrera
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'

Re: [SQL] SELECT syntax synopsis: column_definition?

2007-08-21 Thread Richard Broersma Jr
--- 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.

Re: [SQL] SELECT syntax synopsis: column_definition?

2007-08-21 Thread Tom Lane
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