From: Tom Lane <tgl@sss.pgh.pa.us>
To: Gregory Stark <stark@enterprisedb.com>
Cc: Michael Glaesemann <grzm@seespotcode.net>
Cc: Richard Broersma Jr <rabroersma@yahoo.com>
Cc: SQL Postgresql List <pgsql-sql@postgresql.org>
Subject: Re: SELECT syntax synopsis: column_definition?
Date: Wed, 22 Aug 2007 01:33:08 -0400
Message-ID: <2399.1187760788@sss.pgh.pa.us> (raw)
In-Reply-To: <87zm0kigwe.fsf@oxford.xeocode.com>
References: <830878.14424.qm@web31803.mail.mud.yahoo.com>
<50700110-2B0D-4935-B033-084ED908BEC5@seespotcode.net>
<87zm0kigwe.fsf@oxford.xeocode.com>
Gregory Stark <stark@enterprisedb.com> 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 something like
select *
from dblink('select a,b,c from remote_table') as (a int, b text, c float8);
The declaration of dblink can't be any more specific than "RETURNS SETOF
RECORD", so there's no help to be had there. The only way to explain to
the parser what your dblink call is going to return is something like
the above. And the parser does need to know it, so it knows what to
expand "*" to (or more generally, to do things like joins involving the
rowset result).
regards, tom lane
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: tgl@sss.pgh.pa.us, stark@enterprisedb.com, grzm@seespotcode.net, rabroersma@yahoo.com
Subject: Re: SELECT syntax synopsis: column_definition?
In-Reply-To: <2399.1187760788@sss.pgh.pa.us>
* 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