Re: Two division by 0 errors in optimizer/plan/planner.c and optimizer/path/costsize.c

Поиск
Список
Период
Сортировка
От Piotr Stefaniak
Тема Re: Two division by 0 errors in optimizer/plan/planner.c and optimizer/path/costsize.c
Дата
Msg-id BLU437-SMTP67C2A4915E150388A48445F2850@phx.gbl
обсуждение исходный текст
Ответ на Re: Two division by 0 errors in optimizer/plan/planner.c and optimizer/path/costsize.c  (Piotr Stefaniak <postgres@piotr-stefaniak.me>)
Ответы Re: Two division by 0 errors in optimizer/plan/planner.c and optimizer/path/costsize.c  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Two division by 0 errors in optimizer/plan/planner.c and optimizer/path/costsize.c  (Aleksander Alekseev <a.alekseev@postgrespro.ru>)
Список pgsql-hackers
On 2016-03-26 19:29, Piotr Stefaniak wrote:
> I'm not saying this is necessarily a bug since the whole function deals
> with floats, but perhaps it's interesting to note that ndistinct can be
> 0 in src/backend/utils/adt/selfuncs.c:estimate_hash_bucketsize:

On the exact same note, something like this (again reduced from what
sqlsmith produced):

select 1
from unnest('{}'::boolean[]) a (x)
left join (
   select *
   from unnest('{}'::boolean[])
   where false
) b (x) on a.x = b.x;

leads to vardata.rel->tuples being zero here:
    if (vardata.rel)
        ndistinct *= vardata.rel->rows / vardata.rel->tuples;

Back-trace attached.


Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Fabien COELHO
Дата:
Сообщение: Re: extend pgbench expressions with functions
Следующее
От: Alexander Korotkov
Дата:
Сообщение: Re: Move PinBuffer and UnpinBuffer to atomics