Re: SELECT syntax synopsis: column_definition? - Mailing list pgsql-sql

From Michael Glaesemann
Subject Re: SELECT syntax synopsis: column_definition?
Date
Msg-id 50700110-2B0D-4935-B033-084ED908BEC5@seespotcode.net
Whole thread Raw
In response to SELECT syntax synopsis: column_definition?  (Richard Broersma Jr <rabroersma@yahoo.com>)
Responses Re: SELECT syntax synopsis: column_definition?
Re: SELECT syntax synopsis: column_definition?
List pgsql-sql
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 ( [ argument [, ...] ] ) [ AS ] alias  
> [ ( column_alias [, ...] | column_definition
> [, ...] ) ]"

I believe it's similar to this

# select * from generate_series(1,10) as a(s);
s
----  1  2  3  4  5  6  7  8  9
10
(10 rows)

But like this:

# select * from generate_series(1,10) as a(s text);

But not quite, as this raises an error :)

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.

You've got me curious now, too!

Michael Glaesemann
grzm seespotcode net




pgsql-sql by date:

Previous
From: "Scott Marlowe"
Date:
Subject: Re: Make a SQL statement not run trigger
Next
From: Michael Glaesemann
Date:
Subject: Re: SELECT syntax synopsis: column_definition?