pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Glaesemann <grzm@seespotcode.net>
To: Richard Broersma Jr <rabroersma@yahoo.com>
Cc: SQL Postgresql List <pgsql-sql@postgresql.org>
Subject: Re: SELECT syntax synopsis: column_definition?
Date: Tue, 21 Aug 2007 18:04:56 -0500
Message-ID: <50700110-2B0D-4935-B033-084ED908BEC5@seespotcode.net> (raw)
In-Reply-To: <830878.14424.qm@web31803.mail.mud.yahoo.com>
References: <830878.14424.qm@web31803.mail.mud.yahoo.com>


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





view thread (8+ messages)  latest in thread

Message-ID: <50700110-2B0D-4935-B033-084ED908BEC5@seespotcode.net>
Permalink:  ../50700110-2B0D-4935-B033-084ED908BEC5@seespotcode.net/
Also on:    postgresql.org/message-id/50700110-2B0D-4935-B033-084ED908BEC5@seespotcode.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: grzm@seespotcode.net, rabroersma@yahoo.com
  Subject: Re: SELECT syntax synopsis: column_definition?
  In-Reply-To: <50700110-2B0D-4935-B033-084ED908BEC5@seespotcode.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox