Re: target list evaluation wrt sequences

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: target list evaluation wrt sequences
Дата
Msg-id 20921.1083301285@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: target list evaluation wrt sequences  (Bruno Wolff III <bruno@wolff.to>)
Ответы Re: target list evaluation wrt sequences  (Bruno Wolff III <bruno@wolff.to>)
Список pgsql-general
>   elein <elein@varlena.com> wrote:
>> Is the order of the target list guaranteed?

AFAIR, all current and past Postgres versions evaluate target lists
left-to-right.  This is not guaranteed to remain true forever,
since neither the SQL spec nor our own docs promise it anywhere...
but offhand I can't think of a reason to break it.

Bruno Wolff III <bruno@wolff.to> writes:
> No. You can do effectively this by joining a select nextval to whatever
> you main select is. Something like:
> insert into ...
>        select a.n as a, a.n as b, ....
>              from (select nextval('n') as n) as a, lalala

Urgh ... I'd not want to promise that nextval() will always be evaluated
just once in the above example ... this really seems *much* more fragile
than assuming left-to-right targetlist evaluation :-(

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: TCP only listening on localhost???
Следующее
От: "Gregory S. Williamson"
Дата:
Сообщение: Re: "Idle in Transaction" and hung connections