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

2016-06-29 Thread Tom Lane
"David G. Johnston" writes: > A correlated subquery, on the other hand, has to be called once for every > row and is evaluated within the context supplied by said row. Each time > random is called it returns a new value. > Section 4.2.11 (9.6 docs) >

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

2016-06-29 Thread Tom Lane
[ Please do not quote the entire thread in each followup. That's disrespectful of your readers' time, and will soon cause people to stop reading the thread, meaning you don't get answers. ] Alex Ignatov writes: > In this subquery(below) we have reference to outer

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

2016-06-29 Thread Alex Ignatov
On 29.06.2016 15:30, David G. Johnston wrote: More specifically... On Wed, Jun 29, 2016 at 7:34 AM, Michael Paquier >wrote: On Wed, Jun 29, 2016 at 7:43 PM, Alex Ignatov

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

2016-06-29 Thread David G. Johnston
More specifically... On Wed, Jun 29, 2016 at 7:34 AM, Michael Paquier wrote: > On Wed, Jun 29, 2016 at 7:43 PM, Alex Ignatov > wrote: > > Hello! > > > > Got some strange behavior of random() function: > > > > postgres=# select (select

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

2016-06-29 Thread Michael Paquier
On Wed, Jun 29, 2016 at 7:43 PM, Alex Ignatov 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

[HACKERS] Strange behavior of some volatile function like random(), nextval()

2016-06-29 Thread Alex Ignatov
Hello! Got some strange behavior of random() function: postgres=# select (select random() ) from generate_series(1,10) as i; random --- 0.831577288918197 0.831577288918197 0.831577288918197 0.831577288918197 0.831577288918197 0.831577288918197 0.831577288918197