From: Teodor Sigaev Date: Mon, 31 Oct 2005 13:47:09 +0000 (+0000) Subject: Add sanity check of query X-Git-Tag: REL8_1_0~33 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1dd6bd19fa7c71e4c2ee7226266ea0291049a8ee;p=thirdparty%2Fpostgresql.git Add sanity check of query --- diff --git a/contrib/tsearch2/rank.c b/contrib/tsearch2/rank.c index 40bec1f4840..445898eff69 100644 --- a/contrib/tsearch2/rank.c +++ b/contrib/tsearch2/rank.c @@ -303,7 +303,8 @@ calc_rank_or(float *w, tsvector * t, QUERYTYPE * q) */ res = res + ( wjm + resj - wjm/((jm+1)*(jm+1)))/1.64493406685; } - res = res /size; + if ( size > 0 ) + res = res /size; pfree(item); return res; }