void
update_table_thresholds(db_info * dbi, tbl_info * tbl, int vacuum_type)
{
- PGresult *res = NULL;
+ PGresult *res;
int disconnect = 0;
char query[128];
{
snprintf(query, sizeof(query), PAGES_QUERY, tbl->relid);
res = send_query(query, dbi);
- if (res != NULL)
+ if (res != NULL && PQntuples(res) > 0)
{
tbl->reltuples =
atof(PQgetvalue(res, 0, PQfnumber(res, "reltuples")));
(args->analyze_base_threshold + args->analyze_scaling_factor * tbl->reltuples);
tbl->CountAtLastAnalyze = tbl->curr_analyze_count;
- PQclear(res);
-
/*
* If the stats collector is reporting fewer updates then we
* have on record then the stats were probably reset, so we
tbl->CountAtLastVacuum = tbl->curr_vacuum_count;
}
}
+
+ PQclear(res);
}
if (disconnect)
db_disconnect(dbi);