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.