pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Aleksander Alekseev <aleksander@timescale.com>
Cc: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Subject: Re: rand48 replacement
Date: Thu, 1 Jul 2021 22:36:08 +0200 (CEST)
Message-ID: <alpine.DEB.2.22.394.2107012209160.2248546@pseudo> (raw)
In-Reply-To: <746421.1625164869@sss.pgh.pa.us>
References: <alpine.DEB.2.22.394.2105241211230.165418@pseudo>
	<43a6e30b-542f-671a-e7bb-b7f78cf90e8c@enterprisedb.com>
	<alpine.DEB.2.22.394.2105241310350.165418@pseudo>
	<CAJ7c6TM2qJdtehyLA79gFtZ+h7jwRrksK4ZAW7boxgQJqQkRAw@mail.gmail.com>
	<alpine.DEB.2.22.394.2105241509200.165418@pseudo>
	<699567.1625156441@sss.pgh.pa.us>
	<alpine.DEB.2.22.394.2107011842240.2143494@pseudo>
	<746421.1625164869@sss.pgh.pa.us>


Hello Tom,

>> Indeed. Here is a blind attempt at fixing the build, I'll check later to
>> see whether it works. It would help me if the cfbot results were
>> integrated into the cf app.
>
> Hmm, not there yet per cfbot, not sure why not.

I'll investigate.

> Anyway, after taking a very quick look at the patch itself, I've
> got just one main objection: I don't approve of putting this in
> port.h or src/port/.  erand48.c is there because we envisioned it
> originally as an occasionally-used substitute for libc facilities.
> But this is most certainly not that, so it belongs in src/common/
> instead.

Ok, this would make sense.

> I'd also be inclined to invent a new single-purpose .h
> file for it.

Hmmm. Why not.

> I see that you probably did that because random.c and srandom.c
> depend on it, but I wonder why we don't make an effort to flush
> those altogether.

Ok for removing them. They are used in contrib where they can be replaced. 
I hope that extensions would not depend on that, though.

> It's surely pretty confusing to newbies that what appears to be a call 
> of the libc primitives is no such thing.

I do not understand your point.

If people believe the current random() implementation to be *the* libc 
primitive, then my linux doc says "The random() function uses a nonlinear 
additive feedback random number generator employing a default table of 
size 31 long integers to return successive pseudo-random numbers in the 
range from 0 to RAND_MAX.  The period of this random number generator is 
very large, approximately 16 * ((2^31) - 1).", which is pretty far from 
the rand48 implementation provided in port, so ISTM that the confusion is 
already there?

-- 
Fabien.





view thread (59+ messages)  latest in thread

Message-ID: <alpine.DEB.2.22.394.2107012209160.2248546@pseudo>
Permalink:  ../alpine.DEB.2.22.394.2107012209160.2248546@pseudo/
Also on:    postgresql.org/message-id/alpine.DEB.2.22.394.2107012209160.2248546@pseudo

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: coelho@cri.ensmp.fr, tgl@sss.pgh.pa.us, aleksander@timescale.com
  Subject: Re: rand48 replacement
  In-Reply-To: <alpine.DEB.2.22.394.2107012209160.2248546@pseudo>
  References: <alpine.DEB.2.22.394.2105241211230.165418@pseudo> <43a6e30b-542f-671a-e7bb-b7f78cf90e8c@enterprisedb.com> <alpine.DEB.2.22.394.2105241310350.165418@pseudo> <CAJ7c6TM2qJdtehyLA79gFtZ+h7jwRrksK4ZAW7boxgQJqQkRAw@mail.gmail.com> <alpine.DEB.2.22.394.2105241509200.165418@pseudo> <699567.1625156441@sss.pgh.pa.us> <alpine.DEB.2.22.394.2107011842240.2143494@pseudo> <746421.1625164869@sss.pgh.pa.us> <alpine.DEB.2.22.394.2107012209160.2248546@pseudo>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox