Re: Strange behavior of some volatile function like random(), nextval()

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Strange behavior of some volatile function like random(), nextval()
Дата
Msg-id CAB7nPqQYO+4HYmrYGBXE3V9G8fJuUsdZ4U-gMgx91QVPUMmRVw@mail.gmail.com
обсуждение исходный текст
Ответ на Strange behavior of some volatile function like random(), nextval()  (Alex Ignatov <a.ignatov@postgrespro.ru>)
Ответы Re: Strange behavior of some volatile function like random(), nextval()  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-hackers
On Wed, Jun 29, 2016 at 7:43 PM, Alex Ignatov <a.ignatov@postgrespro.ru> wrote:
> Hello!
>
> Got some strange behavior of random() function:
>
> postgres=# select (select random() ) from generate_series(1,10) as i;
>       random
> -------------------
>  0.831577288918197
> [...]
> (10 rows)

I recall that this is treated as an implicit LATERAL, meaning that
random() is calculated only once.

> postgres=# select (select random()+i*0 ) from generate_series(1,10) as i;
>       ?column?
> --------------------
>    0.97471913928166
> [...]
> (10 rows)

But not that. So those results do not surprise me.
-- 
Michael



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

Предыдущее
От: Sachin Kotwal
Дата:
Сообщение: pgbench unable to scale beyond 100 concurrent connections
Следующее
От: Fabien COELHO
Дата:
Сообщение: Re: pgbench unable to scale beyond 100 concurrent connections