Hi, || curpages <= 0 expression is always false and can be safely removed. Reasons: 1. curpages is uint32 type 2. its already test if is zero before. 3. Never be negative
regards, Ranier Vilela
diff --git a/src/backend/access/table/tableam.c b/src/backend/access/table/tableam.c index 5d3f5c3f54..bf200b6180 100644 --- a/src/backend/access/table/tableam.c +++ b/src/backend/access/table/tableam.c @@ -640,7 +640,7 @@ table_block_relation_estimate_size(Relation rel, int32 *attr_widths, * the last VACUUM are most likely not marked all-visible. But costsize.c * wants it converted to a fraction. */ - if (relallvisible == 0 || curpages <= 0) + if (relallvisible == 0) *allvisfrac = 0; else if ((double) relallvisible >= curpages) *allvisfrac = 1; diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c index 5e889d1861..651a06ff2f 100644 --- a/src/backend/optimizer/util/plancat.c +++ b/src/backend/optimizer/util/plancat.c @@ -1040,7 +1040,7 @@ estimate_rel_size(Relation rel, int32 *attr_widths, * pages added since the last VACUUM are most likely not marked * all-visible. But costsize.c wants it converted to a fraction. */ - if (relallvisible == 0 || curpages <= 0) + if (relallvisible == 0) *allvisfrac = 0; else if ((double) relallvisible >= curpages) *allvisfrac = 1;