[GENERAL] Custom shuffle function stopped working in 9.6 - Mailing list pgsql-general

From Alexander Farber
Subject [GENERAL] Custom shuffle function stopped working in 9.6
Date
Msg-id CAADeyWh+PcpcObFNEEtL6XSOh2LY-RuFtewTCsk=Ba0djj58Pg@mail.gmail.com
Whole thread Raw
Responses Re: [GENERAL] Custom shuffle function stopped working in 9.6  (Pavel Stehule <pavel.stehule@gmail.com>)
Re: [GENERAL] Custom shuffle function stopped working in 9.6  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: [GENERAL] Custom shuffle function stopped working in 9.6  (Francisco Olarte <folarte@peoplecall.com>)
List pgsql-general
Good evening,

after switching to 9.6.2 from 9.5.3 the following custom function has stopped working:

CREATE OR REPLACE FUNCTION words_shuffle(in_array varchar[])
        RETURNS varchar[] AS
$func$
        SELECT array_agg(letters.x) FROM 
        (SELECT UNNEST(in_array) x ORDER BY RANDOM()) letters;
$func$ LANGUAGE sql STABLE;

In 9.5.3 it was shuffling characters:

words=> select words_shuffle(ARRAY['a','b','c','d','e','f']);
 words_shuffle 
---------------
 {c,d,b,a,e,f}
(1 row)

But in 9.6.2 it has stopped doing so:
words=> select words_shuffle(ARRAY['a','b','c','d','e','f']);
 words_shuffle 
---------------
 {a,b,c,d,e,f}
(1 row)

Any suggestions for a better shuffling function please?

Regards
Alex

pgsql-general by date:

Previous
From: Sylvain Marechal
Date:
Subject: Re: [GENERAL] BDR problem rejoining node
Next
From: Pavel Stehule
Date:
Subject: Re: [GENERAL] Custom shuffle function stopped working in 9.6