Re: SELECT syntax synopsis: column_definition?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: SELECT syntax synopsis: column_definition?
Дата
Msg-id 2399.1187760788@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: SELECT syntax synopsis: column_definition?  (Gregory Stark <stark@enterprisedb.com>)
Список pgsql-sql
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


В списке pgsql-sql по дате отправления:

Предыдущее
От: novice
Дата:
Сообщение: raw data into table process
Следующее
От: roopa perumalraja
Дата:
Сообщение: Solution to retrieve first and last row for each minute