From: Vadim B. Mikheev Date: Wed, 9 Apr 1997 02:20:32 +0000 (+0000) Subject: getattnvals(): if attnvals in pg_attribute is 0 then use X-Git-Tag: REL6_1~343 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2fd9273d97ce995cadc71e87aa6216a69972cbc1;p=postgresql getattnvals(): if attnvals in pg_attribute is 0 then use ATTNVALS_SCALE/reltuples (instead of reltuples). --- diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c index 769024bd42..b127e4238b 100644 --- a/src/backend/utils/adt/selfuncs.c +++ b/src/backend/utils/adt/selfuncs.c @@ -12,7 +12,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.5 1997/02/07 16:23:39 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.6 1997/04/09 02:20:32 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -291,6 +291,15 @@ getattnvals(Oid relid, AttrNumber attnum) return(0); } nvals = ((Form_pg_class) GETSTRUCT(atp))->reltuples; + /* Look above how nvals is used. - vadim 04/09/97 */ + if ( nvals > 0 ) + { + double selratio = 1.0 / (double)nvals; + + selratio *= (double)ATTNVALS_SCALE; + nvals = (int) ceil (selratio); + } + return(nvals); }