Re: Using random() in update produces same random value for all - Mailing list pgsql-general

From Jeff Janes
Subject Re: Using random() in update produces same random value for all
Date
Msg-id CAMkU=1xi9aRSMfB4Lz2C5yJfekqM4==0JuBTH9LqYcJzXA2-5Q@mail.gmail.com
Whole thread Raw
In response to Re: Using random() in update produces same random value for all  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Using random() in update produces same random value for all  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Mon, Jan 22, 2018 at 9:16 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Olleg Samoylov <splarv@ya.ru> writes:
> Looked like random() is "volatile", but in subselect it works like "stable".

The point here is that that's an uncorrelated subselect --- ie, it
contains no outer references --- so it need not be, and is not,
re-evaluated at every outer row.

That seems rather circular.  Why shouldn't a volatile be honored as volatile just because it is in an uncorrelated sub-select?

Cheers,

Jeff

pgsql-general by date:

Previous
From: Laurenz Albe
Date:
Subject: Re: Slow alter sequence with PG10.1
Next
From: Tom Lane
Date:
Subject: Re: Using random() in update produces same random value for all