Re: PG 7.2b4 bug?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: PG 7.2b4 bug?
Дата
Msg-id 7062.1008623588@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: PG 7.2b4 bug?  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Ответы Re: PG 7.2b4 bug?  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-hackers
Stephan Szabo <sszabo@megazone23.bigpanda.com> writes:
> However, I'd think:
> "select (select nextval from test_seq) from multiple_rows;"
> should give you different values and doesn't, although
> "select (select nextval from test_seq where i IS NULL or i IS NOT NULL)
>  from multiple_rows;" does give you different values.

In the first case, the subselect is visibly not dependent on the outer
query, so it's evaluated only once; in the second case it has to be
re-evaluated for each row using that row's value of i.  You can see the
difference (InitPlan vs. SubPlan) in the query's EXPLAIN output.
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: recursive SQL functions
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: PG 7.2b4 bug?