From: | Martin Kalcher <martin(dot)kalcher(at)aboutsource(dot)net> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Andrew Dunstan <andrew(at)dunslane(dot)net>, John Naylor <john(dot)naylor(at)enterprisedb(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: [PATCH] Introduce array_shuffle() and array_sample() |
Date: | 2022-07-19 20:20:57 |
Message-ID: | 7e7cf274-09cb-00cf-1715-979f011e40b0@aboutsource.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general 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
Attachment | Content-Type | Size |
---|---|---|
0001-Introduce-array_shuffle-and-array_sample.patch | text/x-patch | 10.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Marc Millas | 2022-07-19 21:09:56 | Re: postgis |
Previous Message | Adrian Klaver | 2022-07-19 18:42:27 | Re: postgis |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2022-07-19 20:27:08 | Re: pg_parameter_aclcheck() and trusted extensions |
Previous Message | Tom Lane | 2022-07-19 19:27:56 | Re: postgres_fdw: using TABLESAMPLE to collect remote sample |