I'm not sure if that query will do what you want, but to make it work, one
thing you might try, is to pre calculate the random values for each record,
then order by those, eg:
select trip_code, random() as rand from obs order by rand;
works for me, so the following might for you:
:
UPDA
On Thu, Feb 12, 2009 at 05:39:49PM +, Rory Campbell-Lange wrote:
> On 12/02/09, Rory Campbell-Lange (r...@campbell-lange.net) wrote:
> > I realise that for every row in my users table (which has a unique
> > integer field) I can update it if I construct a matching id field
> > against a random
On 12/02/09, Rory Campbell-Lange (r...@campbell-lange.net) wrote:
> I realise that for every row in my users table (which has a unique
> integer field) I can update it if I construct a matching id field
> against a random row from the testnames table.
I can make my join table pretty well by using
On 12/02/09, Tom Lane (t...@sss.pgh.pa.us) wrote:
> =?UTF-8?Q?Grzegorz_Ja=C5=9Bkiewicz?= writes:
> > On Thu, Feb 12, 2009 at 1:10 PM, Rory Campbell-Lange
> > wrote:
> >> UPDATE
> >> users
> >> SET t_firstname =
> >> (select firstname from testnames order by random() limit 1),
> >> t_surname =
> >
Hi Grzegorz
Many thanks for your reply.
On 12/02/09, Grzegorz Ja??kiewicz (gryz...@gmail.com) wrote:
> actually forget about that generate_series() in sub queries, I just
> realized that it won't do.
> I don't have too much time to analyse and find solution, but
> essentially you need to do it li
=?UTF-8?Q?Grzegorz_Ja=C5=9Bkiewicz?= writes:
> On Thu, Feb 12, 2009 at 1:10 PM, Rory Campbell-Lange
> wrote:
>> UPDATE
>> users
>> SET t_firstname =
>> (select firstname from testnames order by random() limit 1),
>> t_surname =
>> (select lastname from testnames order by random() limit 1)
>> WHER
actually forget about that generate_series() in sub queries, I just
realized that it won't do.
I don't have too much time to analyse and find solution, but
essentially you need to do it like in my example.
See, that's where normalization would help a lot. Ie, having a
separate table for name, and
On Thu, Feb 12, 2009 at 1:10 PM, Rory Campbell-Lange
wrote:
>UPDATE
>users
>SET t_firstname =
>(select firstname from testnames order by random() limit
> 1),
>t_surname =
>(select lastname from testnames order by random() limit 1
I have a test system for which I need to replace actual user's data (in
'users') with anonymised data from another table ('testnames') on
postgres 8.3.
The tricky aspect is that each row from testnames must be randomised to
avoid each row in users being updated with the same value.
I've been try
On 12/02/09, Rory Campbell-Lange (r...@campbell-lange.net) wrote:
> I have a test system for which I need to replace actual user's data (in
> 'users') with anonymised data from another table ('testnames') on
> postgres 8.3.
>
> The tricky aspect is that each row from testnames must be randomised
10 matches
Mail list logo