[postgis-devel] After ANALYZE, null_frac always 0

Michael Fuhr mike at fuhr.org
Thu Oct 6 20:27:14 PDT 2005


After ANALYZE, pg_stats.null_frac shows 0 for geometry columns even
if some values are NULL.  This appears to be due to the following
line in compute_geometry_stats() (around line 2265 in lwgeom_estimate.c):

    stats->stanullfrac = null_cnt/samplerows;

null_cnt and samplerows are both integers, so integer division is
done before the result is assigned to stanullfrac.  Shouldn't one
of the operands be cast to float4 so stanullfrac gets the correct
value?

-- 
Michael Fuhr



More information about the postgis-devel mailing list