Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf1edf02

Browse files
committed
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.
1 parentac3d7b3 commitf1edf02

File tree

9 files changed

+52
-53
lines changed

9 files changed

+52
-53
lines changed

‎src/backend/catalog/heap.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.18 1997/08/2101:32:03 vadim Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.19 1997/08/2102:27:53 momjian Exp $
1111
*
1212
* INTERFACE ROUTINES
1313
*heap_creatr()- Create an uncataloged heap relation
@@ -571,7 +571,7 @@ AddNewAttributeTuples(Oid new_rel_oid,
571571
dpp=tupdesc->attrs;
572572
for (i=0;i<natts;i++) {
573573
(*dpp)->attrelid=new_rel_oid;
574-
(*dpp)->attnvals=0l;
574+
(*dpp)->attnvals=0;
575575

576576
tup=heap_addheader(Natts_pg_attribute,
577577
ATTRIBUTE_TUPLE_SIZE,
@@ -592,7 +592,7 @@ AddNewAttributeTuples(Oid new_rel_oid,
592592
dpp=HeapAtt;
593593
for (i=0;i<-1-FirstLowInvalidHeapAttributeNumber;i++) {
594594
(*dpp)->attrelid=new_rel_oid;
595-
/*(*dpp)->attnvals =0l;unneeded */
595+
/*(*dpp)->attnvals =0;unneeded */
596596

597597
tup=heap_addheader(Natts_pg_attribute,
598598
ATTRIBUTE_TUPLE_SIZE,

‎src/backend/commands/vacuum.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.39 1997/08/18 20:52:21 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.40 1997/08/21 02:27:58 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1814,7 +1814,7 @@ vc_updstats(Oid relid, int npages, int ntups, bool hasindex, VRelStats *vacrelst
18141814
}
18151815
if (selratio>1.0)
18161816
selratio=1.0;
1817-
attp->attnvals=(selratio ? (selratio*ATTNVALS_SCALE) :0);
1817+
attp->attnvals=selratio;
18181818
WriteNoReleaseBuffer(abuf);
18191819

18201820
/* DO PG_STATISTIC INSERTS */

‎src/backend/executor/nodeSort.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.5 1997/08/06 03:41:31 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.6 1997/08/21 02:28:06 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -170,7 +170,7 @@ ExecSort(Sort *node)
170170
/* *** get_cs_ResultTupleSlot((CommonState) sortstate); */
171171

172172
slot->ttc_tupleDescriptor=ExecGetTupType(outerNode);
173-
#ifdef0
173+
#if0
174174
slot->ttc_execTupDescriptor=ExecGetExecTupDesc(outerNode);
175175
#endif
176176
/* ----------------

‎src/backend/port/aix/dlfcn.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include<a.out.h>
1414
#include<ldfcn.h>
1515
#include"dlfcn.h"
16+
#include"c.h"
1617

1718
/*
1819
* We simulate dlopen() et al. through a call to load. Because AIX has

‎src/backend/utils/adt/selfuncs.c

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
*
1414
* IDENTIFICATION
15-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.6 1997/04/09 02:20:32 vadim Exp $
15+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.7 1997/08/21 02:28:34 momjian Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -33,8 +33,6 @@
3333
#include"utils/lsyscache.h"/* for get_oprrest() */
3434
#include"catalog/pg_statistic.h"
3535

36-
#include"commands/vacuum.h"/* for ATTNVALS_SCALE */
37-
3836
/* N is not a valid var/constant or relation id */
3937
#defineNONVALUE(N)((N) == -1)
4038

@@ -43,7 +41,7 @@
4341
*/
4442
#defineFunctionalSelectivity(nIndKeys,attNum) (attNum==InvalidAttrNumber)
4543

46-
staticint32getattnvals(Oidrelid,AttrNumberattnum);
44+
staticfloat32datagetattnvals(Oidrelid,AttrNumberattnum);
4745
staticvoidgethilokey(Oidrelid,AttrNumberattnum,Oidopid,
4846
char**high,char**low);
4947

@@ -58,19 +56,13 @@ eqsel(Oid opid,
5856
char*value,
5957
int32flag)
6058
{
61-
int32nvals;
6259
float64result;
6360

6461
result= (float64)palloc(sizeof(float64data));
6562
if (NONVALUE(attno)||NONVALUE(relid))
6663
*result=0.1;
67-
else {
68-
nvals=getattnvals(relid, (int)attno);
69-
if (nvals==0)
70-
*result=0.0;
71-
else
72-
*result= ((float64data)nvals) / ((float64data)ATTNVALS_SCALE);
73-
}
64+
else
65+
*result= (float64data)getattnvals(relid, (int)attno);
7466
return(result);
7567
}
7668

@@ -102,7 +94,7 @@ intltsel(Oid opid,
10294
int32value,
10395
int32flag)
10496
{
105-
float64result;
97+
float64result;
10698
char*highchar,*lowchar;
10799
longval,high,low,top,bottom;
108100

@@ -121,12 +113,15 @@ intltsel(Oid opid,
121113
low=atol(lowchar);
122114
if ((flag&SEL_RIGHT&&val<low)||
123115
(!(flag&SEL_RIGHT)&&val>high)) {
124-
intnvals;
116+
float32datanvals;
125117
nvals=getattnvals(relid, (int)attno);
126118
if (nvals==0)
127119
*result=1.0 /3.0;
128-
else
129-
*result=3.0* ((float64data)nvals) / ((float64data)ATTNVALS_SCALE);
120+
else {
121+
*result=3.0* (float64data)nvals;
122+
if (*result>1.0)
123+
*result=1;
124+
}
130125
}else {
131126
bottom=high-low;
132127
if (bottom==0)
@@ -180,7 +175,7 @@ eqjoinsel(Oid opid,
180175
AttrNumberattno2)
181176
{
182177
float64result;
183-
int32num1,num2,max;
178+
float32datanum1,num2,max;
184179

185180
result= (float64)palloc(sizeof(float64data));
186181
if (NONVALUE(attno1)||NONVALUE(relid1)||
@@ -193,7 +188,7 @@ eqjoinsel(Oid opid,
193188
if (max==0)
194189
*result=1.0;
195190
else
196-
*result= ((float64data)max) / ((float64data)ATTNVALS_SCALE);
191+
*result= (float64data)max;
197192
}
198193
return(result);
199194
}
@@ -263,11 +258,12 @@ intgtjoinsel(Oid opid,
263258
*more efficient. However, the cast will not work
264259
*for gethilokey which accesses stahikey in struct statistic.
265260
*/
266-
staticint32
261+
staticfloat32data
267262
getattnvals(Oidrelid,AttrNumberattnum)
268263
{
269264
HeapTupleatp;
270-
intnvals;
265+
float32datanvals;
266+
int32ntuples;
271267

272268
atp=SearchSysCacheTuple(ATTNUM,
273269
ObjectIdGetDatum(relid),
@@ -290,15 +286,10 @@ getattnvals(Oid relid, AttrNumber attnum)
290286
elog(WARN,"getattnvals: no relation tuple %d",relid);
291287
return(0);
292288
}
293-
nvals= ((Form_pg_class)GETSTRUCT(atp))->reltuples;
289+
ntuples= ((Form_pg_class)GETSTRUCT(atp))->reltuples;
294290
/* Look above how nvals is used. - vadim 04/09/97 */
295-
if (nvals>0 )
296-
{
297-
doubleselratio=1.0 / (double)nvals;
298-
299-
selratio *= (double)ATTNVALS_SCALE;
300-
nvals= (int)ceil (selratio);
301-
}
291+
if (ntuples>0 )
292+
nvals=1.0 /ntuples;
302293

303294
return(nvals);
304295
}

‎src/bin/pg_dump/pg_dump.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*
2222
*
2323
* IDENTIFICATION
24-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.38 1997/08/19 21:36:40 momjian Exp $
24+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.39 1997/08/21 02:28:41 momjian Exp $
2525
*
2626
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
2727
*
@@ -805,8 +805,6 @@ clearTableInfo(TableInfo *tblinfo, int numTables)
805805
if (tblinfo[i].sequence )
806806
continue;
807807

808-
if (tblinfo[i].notnull)free (tblinfo[i].notnull);
809-
810808
/* Process Attributes */
811809
for(j=0;j<tblinfo[i].numatts;j++) {
812810
if(tblinfo[i].attnames[j])free (tblinfo[i].attnames[j]);
@@ -816,6 +814,8 @@ clearTableInfo(TableInfo *tblinfo, int numTables)
816814
if(tblinfo[i].inhAttrs)free((int*)tblinfo[i].inhAttrs);
817815
if(tblinfo[i].attnames)free (tblinfo[i].attnames);
818816
if(tblinfo[i].typnames)free (tblinfo[i].typnames);
817+
if(tblinfo[i].notnull)free (tblinfo[i].notnull);
818+
819819
}
820820
free(tblinfo);
821821
}
@@ -1299,7 +1299,7 @@ getTableAttrs(TableInfo* tblinfo, int numTables)
12991299
if (tblinfo[i].attlen[j]>0)
13001300
tblinfo[i].attlen[j]=tblinfo[i].attlen[j]-4;
13011301
tblinfo[i].inhAttrs[j]=0;/* this flag is set in flagInhAttrs()*/
1302-
tblinfo[i].notnull[j]=PQgetvalue(res,j,i_attnotnull)[0]=='t'?true:false;
1302+
tblinfo[i].notnull[j]=(PQgetvalue(res,j,i_attnotnull)[0]=='t')?true:false;
13031303
}
13041304
PQclear(res);
13051305
}
@@ -1514,7 +1514,7 @@ dumpOneFunc(FILE* fout, FuncInfo* finfo, int i,
15141514
}
15151515
sprintf(q,"%s ) RETURNS %s%s AS '%s' LANGUAGE '%s';\n",
15161516
q,
1517-
finfo[i].retset ?" SETOF " :"",
1517+
(finfo[i].retset) ?" SETOF " :"",
15181518
findTypeByOid(tinfo,numTypes,finfo[i].prorettype),
15191519
(finfo[i].lang) ?finfo[i].probin :finfo[i].prosrc,
15201520
(finfo[i].lang) ?"C" :"SQL");
@@ -1779,7 +1779,8 @@ void dumpTables(FILE* fout, TableInfo *tblinfo, int numTables,
17791779
tblinfo[i].typnames[j]);
17801780
actual_atts++;
17811781
}
1782-
sprintf(q,"%s%s NULL",q,tblinfo[i].notnull[j]?" NOT":"");
1782+
sprintf(q,"%s%s NULL",q,
1783+
(tblinfo[i].notnull[j])?" NOT" :"");
17831784
}
17841785
}
17851786

‎src/bin/pg_dump/pg_dumpall

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,33 @@ echo "${BS}connect template1"
2727
#
2828
# delete all users in case they run this twice
2929
#
30-
echo"delete from pg_user"
31-
echo"where usesysid<>$POSTGRES_SUPER_USER_ID;"
30+
# we don't use POSTGRES_SUPER_USER_ID because the postgres super user id
31+
# could be different on the two installations
32+
#
33+
echo"select datdba into tmp_pguser \
34+
from pg_database where datname ='template1';"
35+
echo"delete from pg_user where usesysid<> tmp_pguser.datdba;"
36+
echo"drop table tmp_pguser;"
3237
#
3338
# load all the non-postgres users
3439
#
3540
echo"copy pg_user from stdin;"
3641
psql -q template1 <<END
37-
select pg_user.* into table tmp_pg_user
42+
select pg_user.*
43+
into table tmp_pg_user
3844
from pg_user
3945
where usesysid <>$POSTGRES_SUPER_USER_ID;
4046
copy tmp_pg_user to stdout;
4147
drop table tmp_pg_user;
4248
END
4349
echo"${BS}."
4450
psql -l -A -q -t| tr '|' ' ' | grep -v '^template1 ' |\
45-
while read DATABASEPGUSERID DATAPATH
51+
while read DATABASEDBUSERID DATAPATH
4652
do
4753
POSTGRES_USER="`echo\" \
4854
selectusename \
4955
from pg_user \
50-
where usesysid =$PGUSERID;\"| \
56+
where usesysid =$DBUSERID;\"| \
5157
psql -A -q -t template1`"
5258
echo"${BS}connect template1$POSTGRES_USER"
5359
echo"create database$DATABASE;"

‎src/include/catalog/pg_attribute.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: pg_attribute.h,v 1.9 1997/08/2101:37:51 vadim Exp $
10+
* $Id: pg_attribute.h,v 1.10 1997/08/2102:28:52 momjian Exp $
1111
*
1212
* NOTES
1313
* the genbki.sh script reads this file and generates .bki
@@ -48,7 +48,7 @@ CATALOG(pg_attribute) BOOTSTRAP {
4848
attributes of this instance, so they had better match or Postgres
4949
will fail.
5050
*/
51-
int4attnvals;
51+
float4attnvals;
5252
int2attlen;
5353
/* attlen is a copy of the typlen field from pg_type for this
5454
attribute. See atttypid above. See struct TypeTupleFormData for
@@ -209,7 +209,7 @@ DATA(insert OID = 0 ( 1247 vtype 18 0 1 -11 0 -1 t f c f f));
209209
* ----------------
210210
*/
211211
DATA(insertOID=0 (1262datname190NAMEDATALEN10-1ffiff));
212-
DATA(insertOID=0 (1262datdba260420-1tfiff));
212+
DATA(insertOID=0 (1262datdba230420-1tfsff));
213213
DATA(insertOID=0 (1262datpath250-130-1ffiff));
214214
DATA(insertOID=0 (1262ctid2706-10-1ffiff));
215215
DATA(insertOID=0 (1262oid2604-20-1tfiff));
@@ -362,7 +362,7 @@ DATA(insert OID = 0 ( 1261 vtype 18 0 1 -11 0 -1 t f c f f));
362362
{ 1249l, {"attrelid"}, 26l, 0l, 4, 1, 0l, -1l, '\001', '\0', 'i', '\0', '\0' }, \
363363
{ 1249l, {"attname"}, 19l, 0l, NAMEDATALEN, 2, 0l, -1l, '\0', '\0', 'i', '\0', '\0' }, \
364364
{ 1249l, {"atttypid"}, 26l, 0l, 4, 3, 0l, -1l, '\001', '\0', 'i', '\0', '\0' }, \
365-
{ 1249l, {"attnvals"}, 23l, 0l, 4, 4, 0l, -1l, '\001', '\0', 'i', '\0', '\0' }, \
365+
{ 1249l, {"attnvals"},700l, 0l, 4, 4, 0l, -1l, '\001', '\0', 'i', '\0', '\0' }, \
366366
{ 1249l, {"attlen"}, 21l, 0l, 2, 5, 0l, -1l, '\001', '\0', 's', '\0', '\0' }, \
367367
{ 1249l, {"attnum"}, 21l, 0l, 2, 6, 0l, -1l, '\001', '\0', 's', '\0', '\0' }, \
368368
{ 1249l, {"attnelems"}, 23l, 0l, 4, 7, 0l, -1l, '\001', '\0', 'i', '\0', '\0' }, \
@@ -376,7 +376,7 @@ DATA(insert OID = 0 ( 1261 vtype 18 0 1 -11 0 -1 t f c f f));
376376
DATA(insertOID=0 (1249attrelid260410-1tfiff));
377377
DATA(insertOID=0 (1249attname190NAMEDATALEN20-1ffiff));
378378
DATA(insertOID=0 (1249atttypid260430-1tfiff));
379-
DATA(insertOID=0 (1249attnvals230440-1tfiff));
379+
DATA(insertOID=0 (1249attnvals7000440-1tfiff));
380380
DATA(insertOID=0 (1249attlen210250-1tfsff));
381381
DATA(insertOID=0 (1249attnum210260-1tfsff));
382382
DATA(insertOID=0 (1249attnelems230470-1tfiff));

‎src/include/catalog/pg_database.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: pg_database.h,v 1.2 1996/10/31 09:47:23 scrappy Exp $
10+
* $Id: pg_database.h,v 1.3 1997/08/21 02:28:55 momjian Exp $
1111
*
1212
* NOTES
1313
* the genbki.sh script reads this file and generates .bki
@@ -32,7 +32,7 @@
3232
*/
3333
CATALOG(pg_database)BOOTSTRAP {
3434
NameDatadatname;
35-
Oiddatdba;
35+
int4datdba;
3636
textdatpath;/* VARIABLE LENGTH FIELD */
3737
}FormData_pg_database;
3838

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp