Re: Custom shuffle function stopped working in 9.6

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Custom shuffle function stopped working in 9.6
Date: 2017-02-11 19:03:00
Message-ID: adcf3b01-32c9-99b3-c81f-4c20d7b219db@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 02/11/2017 10:51 AM, Alexander Farber wrote:
> At the same time this advice from
> http://stackoverflow.com/questions/42179012/how-to-shuffle-array-in-postgresql-9-6-and-also-lower-versions
> works, don't know why though:
>
> words=> select array_agg(u order by random())
> words-> from unnest(array['a','b','c','d','e','f']) u;
> array_agg
> ---------------
> {d,a,f,c,b,e}
>

To future proof your code follow the advice shown in the doc snippet in
the first answer to your SO question. This is what I showed in my
answers to your questions.

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2017-02-11 19:04:19 Re: Custom shuffle function stopped working in 9.6
Previous Message Alexander Farber 2017-02-11 18:51:15 Re: Custom shuffle function stopped working in 9.6