From: Tom Lane <tgl@sss.pgh.pa.us>
To: Petr Jelinek <petr@2ndquadrant.com>
Cc: Michael Paquier <michael.paquier@gmail.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@postgresql.org>
Subject: Re: Re: sampling.c and potential divisions by 0 ang log(0) with tablesample and ANALYZE in 9.5
Date: Tue, 30 Jun 2015 12:21:28 -0400
Message-ID: <6412.1435681288@sss.pgh.pa.us> (raw)
In-Reply-To: <6321.1435681035@sss.pgh.pa.us>
References: <CAB7nPqTL0YYPgGt00gV8mw+23U4ki8yXUKV0mfji3YVpAqR8sA@mail.gmail.com>
<558E09FB.6010909@2ndquadrant.com>
<6321.1435681035@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
I wrote:
> Petr Jelinek <petr@2ndquadrant.com> writes:
>> On 2015-06-25 10:01, Michael Paquier wrote:
>>> I think that we should change the returned double to be (0.0,1.0]
>> Agreed.
> I find this to be a pretty bad idea. That definition is simply weird;
> where else in the world will you find a random number generator that does
> that? What are the odds that any callers are actually designed for that
> behavior?
And, in fact, a bit of looking quickly finds a counterexample, in
analyze.c:
int k = (int) (targrows * sampler_random_fract(rstate.randstate));
Assert(k >= 0 && k < targrows);
You can't just whack this around to satisfy some new call sites without
considering the behavior of existing use-cases.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, petr@2ndquadrant.com, michael.paquier@gmail.com
Subject: Re: sampling.c and potential divisions by 0 ang log(0) with tablesample and ANALYZE in 9.5
In-Reply-To: <6412.1435681288@sss.pgh.pa.us>
References: <CAB7nPqTL0YYPgGt00gV8mw+23U4ki8yXUKV0mfji3YVpAqR8sA@mail.gmail.com> <558E09FB.6010909@2ndquadrant.com> <6321.1435681035@sss.pgh.pa.us> <6412.1435681288@sss.pgh.pa.us>
* 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