Re: unintuitive subquery record wrapping

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: unintuitive subquery record wrapping
Дата
Msg-id 12802.1284825023@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: unintuitive subquery record wrapping  (Rikard Pavelic <rikard.pavelic@zg.htnet.hr>)
Список pgsql-general
Rikard Pavelic <rikard.pavelic@zg.htnet.hr> writes:
> I'm arguing that is seems wrong that I need to match alias name like this
> select t from (select t from t) t
> or like this
> select sq from (select sq from t sq) sq
> to get unwrapped type.

This reminds me of the old joke ...
    Patient: Doctor, it hurts when I do this.
    Doctor: So don't do that!

When you write a query like that, there are two ways to resolve the
reference: it could be naming the (single) output column of the
subquery, or it could be naming the entire record result of the
subquery.  PG tries those alternatives in that order.  If you don't
like that, maybe you shouldn't use conflicting alias names.

            regards, tom lane

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

Предыдущее
От: Arjen Nienhuis
Дата:
Сообщение: Re: unintuitive subquery record wrapping
Следующее
От: Bret Green
Дата:
Сообщение: how to insert multiple rows and get the ids back in a temp table (pgplsql)?