On 2018-01-22 23:15, Tom Lane wrote:
>
> It is honored as volatile: it will be re-evaluated every time the
> sub-select is re-evaluated. It's just that there's no cause to
> re-evaluate the sub-select.
>
> I poked through the SQL standard to see if it spells out the semantics
> of uncorrelated sub
Jeff Janes writes:
> On Mon, Jan 22, 2018 at 9:16 AM, Tom Lane wrote:
>> 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 volati
On Mon, Jan 22, 2018 at 9:16 AM, Tom Lane wrote:
> Olleg Samoylov 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,
>
Olleg Samoylov 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.
regard
Yep, interesting. Checked with PostgreSQL 10.1.
=> select *,random() from generate_series(1,10);
generate_series | random
-+---
1 | 0.308531506918371
2 | 0.126279713585973
3 | 0.984668150078505
4
On Sun, Jan 14, 2018 at 2:01 AM, Alex Magnum wrote:
> Hi,
> i am trying to update a table with some random dates but that does not
> seem to work.
>
> UPDATE table
>SET last_update=now()::date-(SELECT (random() * 5)::INTEGER + 1)
>
> The updated field is always set to the same. Is there a way
Hi,
i am trying to update a table with some random dates but that does not seem
to work.
UPDATE table
SET last_update=now()::date-(SELECT (random() * 5)::INTEGER + 1)
The updated field is always set to the same. Is there a way to make it
random for every record?
I could run it through a funct