Re: replace oidrand() with random_sample()

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: replace oidrand() with random_sample()
Дата
Msg-id 26181.1042742609@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: replace oidrand() with random_sample()  (Neil Conway <neilc@samurai.com>)
Список pgsql-patches
Neil Conway <neilc@samurai.com> writes:
> You would have to try *pretty hard* just to know that it existed. And
> even if you decided to use it in an application, it won't take much more
> than grepping for 'oidrand' and replacing it with 'random() < 1.0/y' in
> order to upgrade to 7.4.

Or you could do

CREATE FUNCTION oidrand(oid, int) RETURNS bool AS
'SELECT random() < 1.0/$2' LANGUAGE sql;

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: fix for PL/PgSQL segfault
Следующее
От: Neil Conway
Дата:
Сообщение: Re: replace oidrand() with random_sample()