mirror of
https://github.com/postgres/postgres.git
synced 2025-11-01 21:31:19 +03:00
Change pg_attribute.attnvals to float4, change #ifdef 0 to #if 0, fix aix call to strNcpy, fix pg_super_user_id in pg_dumpall, change pg_database.dtadba from oid to int4.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.18 1997/08/21 01:32:03 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.19 1997/08/21 02:27:53 momjian Exp $
|
||||
*
|
||||
* INTERFACE ROUTINES
|
||||
* heap_creatr() - Create an uncataloged heap relation
|
||||
@@ -571,7 +571,7 @@ AddNewAttributeTuples(Oid new_rel_oid,
|
||||
dpp = tupdesc->attrs;
|
||||
for (i = 0; i < natts; i++) {
|
||||
(*dpp)->attrelid = new_rel_oid;
|
||||
(*dpp)->attnvals = 0l;
|
||||
(*dpp)->attnvals = 0;
|
||||
|
||||
tup = heap_addheader(Natts_pg_attribute,
|
||||
ATTRIBUTE_TUPLE_SIZE,
|
||||
@@ -592,7 +592,7 @@ AddNewAttributeTuples(Oid new_rel_oid,
|
||||
dpp = HeapAtt;
|
||||
for (i = 0; i < -1 - FirstLowInvalidHeapAttributeNumber; i++) {
|
||||
(*dpp)->attrelid = new_rel_oid;
|
||||
/* (*dpp)->attnvals = 0l; unneeded */
|
||||
/* (*dpp)->attnvals = 0; unneeded */
|
||||
|
||||
tup = heap_addheader(Natts_pg_attribute,
|
||||
ATTRIBUTE_TUPLE_SIZE,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.39 1997/08/18 20:52:21 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.40 1997/08/21 02:27:58 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -1814,7 +1814,7 @@ vc_updstats(Oid relid, int npages, int ntups, bool hasindex, VRelStats *vacrelst
|
||||
}
|
||||
if (selratio > 1.0)
|
||||
selratio = 1.0;
|
||||
attp->attnvals = (selratio ? (selratio * ATTNVALS_SCALE) : 0);
|
||||
attp->attnvals = selratio;
|
||||
WriteNoReleaseBuffer(abuf);
|
||||
|
||||
/* DO PG_STATISTIC INSERTS */
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.5 1997/08/06 03:41:31 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.6 1997/08/21 02:28:06 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -170,7 +170,7 @@ ExecSort(Sort *node)
|
||||
/* *** get_cs_ResultTupleSlot((CommonState) sortstate); */
|
||||
|
||||
slot->ttc_tupleDescriptor = ExecGetTupType(outerNode);
|
||||
#ifdef 0
|
||||
#if 0
|
||||
slot->ttc_execTupDescriptor = ExecGetExecTupDesc(outerNode);
|
||||
#endif
|
||||
/* ----------------
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <a.out.h>
|
||||
#include <ldfcn.h>
|
||||
#include "dlfcn.h"
|
||||
#include "c.h"
|
||||
|
||||
/*
|
||||
* We simulate dlopen() et al. through a call to load. Because AIX has
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.6 1997/04/09 02:20:32 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.7 1997/08/21 02:28:34 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -33,8 +33,6 @@
|
||||
#include "utils/lsyscache.h" /* for get_oprrest() */
|
||||
#include "catalog/pg_statistic.h"
|
||||
|
||||
#include "commands/vacuum.h" /* for ATTNVALS_SCALE */
|
||||
|
||||
/* N is not a valid var/constant or relation id */
|
||||
#define NONVALUE(N) ((N) == -1)
|
||||
|
||||
@@ -43,7 +41,7 @@
|
||||
*/
|
||||
#define FunctionalSelectivity(nIndKeys,attNum) (attNum==InvalidAttrNumber)
|
||||
|
||||
static int32 getattnvals(Oid relid, AttrNumber attnum);
|
||||
static float32data getattnvals(Oid relid, AttrNumber attnum);
|
||||
static void gethilokey(Oid relid, AttrNumber attnum, Oid opid,
|
||||
char **high, char **low);
|
||||
|
||||
@@ -58,19 +56,13 @@ eqsel(Oid opid,
|
||||
char *value,
|
||||
int32 flag)
|
||||
{
|
||||
int32 nvals;
|
||||
float64 result;
|
||||
|
||||
result = (float64) palloc(sizeof(float64data));
|
||||
if (NONVALUE(attno) || NONVALUE(relid))
|
||||
*result = 0.1;
|
||||
else {
|
||||
nvals = getattnvals(relid, (int) attno);
|
||||
if (nvals == 0)
|
||||
*result = 0.0;
|
||||
else
|
||||
*result = ((float64data)nvals) / ((float64data)ATTNVALS_SCALE);
|
||||
}
|
||||
else
|
||||
*result = (float64data)getattnvals(relid, (int) attno);
|
||||
return(result);
|
||||
}
|
||||
|
||||
@@ -102,7 +94,7 @@ intltsel(Oid opid,
|
||||
int32 value,
|
||||
int32 flag)
|
||||
{
|
||||
float64 result;
|
||||
float64 result;
|
||||
char *highchar, *lowchar;
|
||||
long val, high, low, top, bottom;
|
||||
|
||||
@@ -121,12 +113,15 @@ intltsel(Oid opid,
|
||||
low = atol(lowchar);
|
||||
if ((flag & SEL_RIGHT && val < low) ||
|
||||
(!(flag & SEL_RIGHT) && val > high)) {
|
||||
int nvals;
|
||||
float32data nvals;
|
||||
nvals = getattnvals(relid, (int) attno);
|
||||
if (nvals == 0)
|
||||
*result = 1.0 / 3.0;
|
||||
else
|
||||
*result = 3.0 * ((float64data)nvals) / ((float64data)ATTNVALS_SCALE);
|
||||
else {
|
||||
*result = 3.0 * (float64data)nvals;
|
||||
if (*result > 1.0)
|
||||
*result = 1;
|
||||
}
|
||||
}else {
|
||||
bottom = high - low;
|
||||
if (bottom == 0)
|
||||
@@ -180,7 +175,7 @@ eqjoinsel(Oid opid,
|
||||
AttrNumber attno2)
|
||||
{
|
||||
float64 result;
|
||||
int32 num1, num2, max;
|
||||
float32data num1, num2, max;
|
||||
|
||||
result = (float64) palloc(sizeof(float64data));
|
||||
if (NONVALUE(attno1) || NONVALUE(relid1) ||
|
||||
@@ -193,7 +188,7 @@ eqjoinsel(Oid opid,
|
||||
if (max == 0)
|
||||
*result = 1.0;
|
||||
else
|
||||
*result = ((float64data)max) / ((float64data)ATTNVALS_SCALE);
|
||||
*result = (float64data)max;
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
@@ -263,11 +258,12 @@ intgtjoinsel(Oid opid,
|
||||
* more efficient. However, the cast will not work
|
||||
* for gethilokey which accesses stahikey in struct statistic.
|
||||
*/
|
||||
static int32
|
||||
static float32data
|
||||
getattnvals(Oid relid, AttrNumber attnum)
|
||||
{
|
||||
HeapTuple atp;
|
||||
int nvals;
|
||||
float32data nvals;
|
||||
int32 ntuples;
|
||||
|
||||
atp = SearchSysCacheTuple(ATTNUM,
|
||||
ObjectIdGetDatum(relid),
|
||||
@@ -290,15 +286,10 @@ getattnvals(Oid relid, AttrNumber attnum)
|
||||
elog(WARN, "getattnvals: no relation tuple %d", relid);
|
||||
return(0);
|
||||
}
|
||||
nvals = ((Form_pg_class) GETSTRUCT(atp))->reltuples;
|
||||
ntuples = ((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);
|
||||
}
|
||||
if ( ntuples > 0 )
|
||||
nvals = 1.0 / ntuples;
|
||||
|
||||
return(nvals);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user