Re: SELECT syntax synopsis: column_definition?

From: Michael Glaesemann <grzm(at)seespotcode(dot)net>
To: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
Cc: SQL Postgresql List <pgsql-sql(at)postgresql(dot)org>
Subject: Re: SELECT syntax synopsis: column_definition?
Date: 2007-08-21 23:04:56
Message-ID: 50700110-2B0D-4935-B033-084ED908BEC5@seespotcode.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Glaesemann 2007-08-21 23:17:17 Re: SELECT syntax synopsis: column_definition?
Previous Message Scott Marlowe 2007-08-21 23:01:24 Re: Make a SQL statement not run trigger