From: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Petr Jelinek <petr(at)2ndquadrant(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org> |
Subject: | Re: Re: sampling.c and potential divisions by 0 ang log(0) with tablesample and ANALYZE in 9.5 |
Date: | 2015-07-02 00:44:10 |
Message-ID: | CAB7nPqRzK6tnVj0rn1Q20h3wOS+bjJOGjBSTZJmzXxTJ5HwuKQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Wed, Jul 1, 2015 at 4:56 PM, Michael Paquier wrote:
> On Wed, Jul 1, 2015 at 1:17 AM, Tom Lane wrote:
>> A simple fix would be to adjust sampler_random_fract to disallow 0
>> as result, say by repeating the pg_erand48 call if it produces 0.
>> I'm not sure if that would throw off any of the math in the new
>> tablesample-related callers. If it would, I'm inclined to fix the
>> problem call-site-by-call-site, rather than inventing a definition
>> of sampler_random_fract() that fails to satisfy the POLA.
>
> Agreed. Disallowing 0 in sampler_random_fract looks like a good answer
> to that. Looking at the tablesample code, for the bernouilli trial I
> recall that the range of probability success and failure is actually
> (0,1), (if p is a success rate, the failure is 1 - p). I am not sure
> for Knuth Algo S though for the system sampling but that looks OK from
> a pure logical viewpoint.
For the sake of the archives, this has been fixed by commit d7c19d68.
(Thanks Tom for pushing it!)
--
Michael
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2015-07-02 00:51:30 | Re: Re: sampling.c and potential divisions by 0 ang log(0) with tablesample and ANALYZE in 9.5 |
Previous Message | Michael Paquier | 2015-07-01 07:56:29 | Re: Re: sampling.c and potential divisions by 0 ang log(0) with tablesample and ANALYZE in 9.5 |