Re: [PATCH] Introduce array_shuffle() and array_sample()
От | Robert Haas |
---|---|
Тема | Re: [PATCH] Introduce array_shuffle() and array_sample() |
Дата | |
Msg-id | CA+TgmoYqC42KS7mypjMKxvGY2oPYz=_kvf1zcDNdawXXiVXqQA@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: [PATCH] Introduce array_shuffle() and array_sample() (Andrew Dunstan <andrew@dunslane.net>) |
Ответы |
Re: [PATCH] Introduce array_shuffle() and array_sample()
|
Список | pgsql-hackers |
On Tue, Jul 19, 2022 at 9:53 AM Andrew Dunstan <andrew@dunslane.net> wrote: > > Having thought about it, i would go with (2). It gives the user the > > ability to decide wether or not array-of-arrays behavior is desired. > > If he wants the behavior of (1) he can flatten the array before > > applying array_shuffle(). Unfortunately there is no array_flatten() > > function (at the moment) and the user would have to work around it > > with unnest() and array_agg(). > > Why not have an optional second parameter for array_shuffle that > indicates whether or not to flatten? e.g. array_shuffle(my_array, > flatten => true) IMHO, if we think that's something many people are going to want, it would be better to add an array_flatten() function, because that could be used for a variety of purposes, whereas an option to this function can only be used for this function. -- Robert Haas EDB: http://www.enterprisedb.com
В списке pgsql-hackers по дате отправления: