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
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)
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(
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','
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
-
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
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
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
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();
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
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)
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
12 matches
Mail list logo