Re: Proposal to introduce a shuffle function to intarray extension
От | David G. Johnston |
---|---|
Тема | Re: Proposal to introduce a shuffle function to intarray extension |
Дата | |
Msg-id | CAKFQuwaMZHx-9NcnBTQV9ObVQfPKixcYbEEPtkJGEdjn-RcxJg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Proposal to introduce a shuffle function to intarray extension (Martin Kalcher <martin.kalcher@aboutsource.net>) |
Ответы |
Re: Proposal to introduce a shuffle function to intarray extension
|
Список | pgsql-hackers |
On Sat, Jul 16, 2022 at 7:25 PM Martin Kalcher <martin.kalcher@aboutsource.net> wrote:
- I added a second function sample(), because it is a lot faster to take
some elements from an array than to shuffle the whole array and
slice it. This function can be removed if it is not wanted. The
important one is shuffle().
+SELECT sample('{1,2,3,4,5,6,7,8,9,10,11,12}', 6) != sample('{1,2,3,4,5,6,7,8,9,10,11,12}', 6);
+ ?column? +----------
+ t
+(1 row)
+
While small, there is a non-zero chance for both samples to be equal. This test should probably just go, I don't see what it tests that isn't covered by other tests or even trivial usage.
Same goes for:
+SELECT shuffle('{1,2,3,4,5,6,7,8,9,10,11,12}') != shuffle('{1,2,3,4,5,6,7,8,9,10,11,12}');
+ ?column?
+----------
+ t
+(1 row)
+
+ ?column?
+----------
+ t
+(1 row)
+
David J.
В списке pgsql-hackers по дате отправления: