Re: [GENERAL] Custom shuffle function stopped working in 9.6

2017-02-12 Thread Francisco Olarte
On Sat, Feb 11, 2017 at 5:37 PM, Alexander Farber wrote: ... > 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 > Any suggestions for a better shuffling function pl

Re: [GENERAL] Custom shuffle function stopped working in 9.6

2017-02-11 Thread Tom Lane
Alexander Farber writes: > 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)

Re: [GENERAL] Custom shuffle function stopped working in 9.6

2017-02-11 Thread Pavel Stehule
2017-02-11 19:51 GMT+01:00 Alexander Farber : > 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(

Re: [GENERAL] Custom shuffle function stopped working in 9.6

2017-02-11 Thread Adrian Klaver
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','

Re: [GENERAL] Custom shuffle function stopped working in 9.6

2017-02-11 Thread Alexander Farber
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 -

Re: [GENERAL] Custom shuffle function stopped working in 9.6

2017-02-11 Thread Alexander Farber
words=> select version(); version -- PostgreSQL 9.6.2 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11), 64-bit (1

Re: [GENERAL] Custom shuffle function stopped working in 9.6

2017-02-11 Thread Jack Christensen
On 02/11/2017 11:36 AM, Adrian Klaver wrote: On 02/11/2017 09:17 AM, Alexander Farber wrote: I think ORDER BY RANDOM() has stopped working in 9.6.2: words=> select unnest(ARRAY['a','b','c','d','e','f']) order by random(); unnest a b c d e f (6 rows) postgres=> select ve

Re: [GENERAL] Custom shuffle function stopped working in 9.6

2017-02-11 Thread Adrian Klaver
On 02/11/2017 09:17 AM, Alexander Farber wrote: I think ORDER BY RANDOM() has stopped working in 9.6.2: words=> select unnest(ARRAY['a','b','c','d','e','f']) order by random(); unnest a b c d e f (6 rows) So back to your original question: CREATE OR REPLACE FUNCTION public.wo

Re: [GENERAL] Custom shuffle function stopped working in 9.6

2017-02-11 Thread Adrian Klaver
On 02/11/2017 09:17 AM, Alexander Farber wrote: > I think ORDER BY RANDOM() has stopped working in 9.6.2: > > words=> select unnest(ARRAY['a','b','c','d','e','f']) order by random(); > unnest > > a > b > c > d > e > f > (6 rows) > postgres=> select version();

Re: [GENERAL] Custom shuffle function stopped working in 9.6

2017-02-11 Thread Melvin Davidson
I don't use an array, but perhaps you can adapt to this function which works in 9.6.1 CREATE OR REPLACE FUNCTION public.scramble(text) RETURNS text AS $BODY$ DECLARE p_inALIAS FOR $1; v_outTEXT DEFAULT ''; v_modTEXT; v_lenINT4; v_ctrINT4; v_posINT4

Re: [GENERAL] Custom shuffle function stopped working in 9.6

2017-02-11 Thread Alexander Farber
I think ORDER BY RANDOM() has stopped working in 9.6.2: words=> select unnest(ARRAY['a','b','c','d','e','f']) order by random(); unnest a b c d e f (6 rows)

Re: [GENERAL] Custom shuffle function stopped working in 9.6

2017-02-11 Thread Pavel Stehule
Hi 2017-02-11 17:37 GMT+01:00 Alexander Farber : > 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