Re: replace oidrand() with random_sample() - Mailing list pgsql-patches

From Neil Conway
Subject Re: replace oidrand() with random_sample()
Date
Msg-id 1042682919.20127.39.camel@tokyo
Whole thread Raw
In response to Re: replace oidrand() with random_sample()  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: replace oidrand() with random_sample()  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
On Wed, 2003-01-15 at 20:21, Tom Lane wrote:
> Do we actually need a separate function at all?  Seems like
>     random() < 1.0/y
> would accomplish the same result.

It does, although it's arguably less obvious. But I wouldn't mind if we
just got rid of it outright. What does everyone else think -- is it
worth keeping?

> I agree that oidrand() is crufty and no longer useful, but I had
> hesitated to rip it out, for fear that somebody somewhere might still
> be using it.  It's not like it's costing us any maintenance effort
> to leave it there.

Keep in mind that it was undocumented and strangely named -- while there
might be some people using it, I'd wager not many.

Whether we leave it in or not, I'd vote for eventually getting rid of
the current version. So if we keep it, we could add random_sample() and
keep oidrand() as a wrapper over it (that emits an elog(WARNING) to let
people know it's been deprecated). And if we want to get rid of it, we
could probably just add the elog() for 7.4 and then remove it outright
in 7.5.

Cheers,

Neil
--
Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC




pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: fix broken regression tests
Next
From: Tom Lane
Date:
Subject: Re: replace oidrand() with random_sample()