Re: replace oidrand() with random_sample()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: replace oidrand() with random_sample()
Date: 2003-01-16 18:43:29
Message-ID: 26181.1042742609@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Neil Conway <neilc(at)samurai(dot)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

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2003-01-16 18:47:48 Re: fix for PL/PgSQL segfault
Previous Message Rod Taylor 2003-01-16 18:41:48 Re: ALTER TABLE .. SET WITHOUT OIDS -- ROUND 2