Postgresql update each row with a random value
I think that Postgres might optimize the subquery. Doesn't this work?
update foo
set bar = floor(random() * 9 + 1); -- from 1 to 10, inclusive
update foo set bar = floor(random() * 10) + 1;
I think that Postgres might optimize the subquery. Doesn't this work?
update foo
set bar = floor(random() * 9 + 1); -- from 1 to 10, inclusive
update foo set bar = floor(random() * 10) + 1;