Re: [PATCH] Introduce array_shuffle() and array_sample()

Поиск
Список
Период
Сортировка
От Martin Kalcher
Тема Re: [PATCH] Introduce array_shuffle() and array_sample()
Дата
Msg-id 7e7cf274-09cb-00cf-1715-979f011e40b0@aboutsource.net
обсуждение исходный текст
Ответ на Re: [PATCH] Introduce array_shuffle() and array_sample()  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [PATCH] Introduce array_shuffle() and array_sample()  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Список pgsql-hackers
Am 19.07.22 um 16:20 schrieb Tom Lane:
> 
> So I withdraw my original position.  These functions should just
> shuffle or select in the array's first dimension, preserving
> subarrays.  Or else be lazy and reject more-than-one-D arrays;
> but it's probably not that hard to handle them.
> 

Here is a patch with dimension aware array_shuffle() and array_sample().

If you think array_flatten() is desirable, i can take a look at it. 
Maybe a second parameter would be nice to specify the target dimension:

   select array_flatten(array[[[1,2],[3,4]],[[5,6],[7,8]]], 1);
   -------------------
    {1,2,3,4,5,6,7,8}

   select array_flatten(array[[[1,2],[3,4]],[[5,6],[7,8]]], 2);
   -----------------------
    {{1,2,3,4},{5,6,7,8}}

Martin
Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: postgres_fdw: using TABLESAMPLE to collect remote sample
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pg_parameter_aclcheck() and trusted extensions