Re: replace oidrand() with random_sample()

From: Neil Conway <neilc(at)samurai(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: replace oidrand() with random_sample()
Date: 2003-01-16 02:08:39
Message-ID: 1042682919.20127.39.camel@tokyo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)samurai(dot)com> || PGP Key ID: DB3C29FC

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2003-01-16 04:26:07 Re: replace oidrand() with random_sample()
Previous Message Tom Lane 2003-01-16 01:21:50 Re: replace oidrand() with random_sample()