]> granicus.if.org Git - postgresql/commitdiff
getattnvals(): if attnvals in pg_attribute is 0 then use
authorVadim B. Mikheev <vadim4o@yahoo.com>
Wed, 9 Apr 1997 02:20:32 +0000 (02:20 +0000)
committerVadim B. Mikheev <vadim4o@yahoo.com>
Wed, 9 Apr 1997 02:20:32 +0000 (02:20 +0000)
ATTNVALS_SCALE/reltuples (instead of reltuples).

src/backend/utils/adt/selfuncs.c

index 769024bd427fe25bf63459219bfb88ad3069e710..b127e4238b2444e6aee1ae5b77f583d2dd088cbd 100644 (file)
@@ -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);
 }