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

Commit5b0fb00

Browse files
committed
The attached patch cleans up some code in pg_dump. It cuts some
unused function arguments, and makes the TableInfo struct slightlysmaller by removing an unnecessary member.Neil Conway <neilconway@rogers.com>
1 parent2446937 commit5b0fb00

File tree

3 files changed

+18
-24
lines changed

3 files changed

+18
-24
lines changed

‎src/bin/pg_dump/common.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.62 2002/02/11 00:18:20 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.63 2002/04/24 02:44:19 momjian Exp $
1212
*
1313
* Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
1414
*
@@ -34,6 +34,8 @@
3434
#include"postgres_fe.h"
3535
#include"pg_dump.h"
3636
#include"pg_backup_archiver.h"
37+
#include"postgres.h"
38+
#include"catalog/pg_class.h"
3739

3840
#include<ctype.h>
3941

@@ -234,6 +236,7 @@ parseNumericArray(const char *str, char **array, int arraysize)
234236
temp[j++]=s;
235237
}
236238
}
239+
237240
while (argNum<arraysize)
238241
array[argNum++]=strdup("0");
239242
}
@@ -344,8 +347,8 @@ dumpSchema(Archive *fout,
344347
if (g_verbose)
345348
write_msg(NULL,"dumping out tables\n");
346349

347-
dumpTables(fout,tblinfo,numTables,indinfo,numIndexes,inhinfo,numInherits,
348-
tinfo,numTypes,tablename,aclsSkip,oids,schemaOnly,dataOnly);
350+
dumpTables(fout,tblinfo,numTables,tablename,
351+
aclsSkip,schemaOnly,dataOnly);
349352

350353
if (fout&& !dataOnly)
351354
{
@@ -425,9 +428,8 @@ flagInhAttrs(TableInfo *tblinfo, int numTables,
425428
*/
426429
for (i=numTables-1;i >=0;i--)
427430
{
428-
429431
/* Sequences can never have parents, and attr info is undefined */
430-
if (tblinfo[i].sequence)
432+
if (tblinfo[i].relkind==RELKIND_SEQUENCE)
431433
continue;
432434

433435
/* Get all the parents and their indexes. */

‎src/bin/pg_dump/pg_dump.c

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*
2323
*
2424
* IDENTIFICATION
25-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.253 2002/04/24 02:42:27 momjian Exp $
25+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.254 2002/04/24 02:44:19 momjian Exp $
2626
*
2727
*-------------------------------------------------------------------------
2828
*/
@@ -574,7 +574,7 @@ dumpClasses(const TableInfo *tblinfo, const int numTables, Archive *fout,
574574
if (tblinfo[i].viewdef!=NULL)
575575
continue;
576576

577-
if (tblinfo[i].sequence)/* already dumped */
577+
if (tblinfo[i].relkind==RELKIND_SEQUENCE)/* already dumped */
578578
continue;
579579

580580
if (!onlytable|| (strcmp(classname,onlytable)==0)|| (strlen(onlytable)==0))
@@ -1672,7 +1672,7 @@ clearTableInfo(TableInfo *tblinfo, int numTables)
16721672
if (tblinfo[i].relname)
16731673
free(tblinfo[i].relname);
16741674

1675-
if (tblinfo[i].sequence)
1675+
if (tblinfo[i].relkind==RELKIND_SEQUENCE)
16761676
continue;
16771677

16781678
/* Process Attributes */
@@ -2212,7 +2212,6 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs, const char *tablename)
22122212
tblinfo[i].relname=strdup(PQgetvalue(res,i,i_relname));
22132213
tblinfo[i].relacl=strdup(PQgetvalue(res,i,i_relacl));
22142214
tblinfo[i].relkind=*(PQgetvalue(res,i,i_relkind));
2215-
tblinfo[i].sequence= (tblinfo[i].relkind==RELKIND_SEQUENCE);
22162215
tblinfo[i].hasindex= (strcmp(PQgetvalue(res,i,i_relhasindex),"t")==0);
22172216
tblinfo[i].hasoids= (strcmp(PQgetvalue(res,i,i_relhasoids),"t")==0);
22182217
tblinfo[i].usename=strdup(PQgetvalue(res,i,i_usename));
@@ -2858,7 +2857,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
28582857

28592858
for (i=0;i<numTables;i++)
28602859
{
2861-
if (tblinfo[i].sequence)
2860+
if (tblinfo[i].relkind==RELKIND_SEQUENCE)
28622861
continue;
28632862

28642863
/* find all the user attributes and their types */
@@ -4242,7 +4241,7 @@ dumpACL(Archive *fout, TableInfo tbinfo)
42424241
}
42434242

42444243
staticvoid
4245-
_dumpTableAttr70(Archive*fout,TableInfo*tblinfo,inti,intj,PQExpBufferq)
4244+
_dumpTableAttr70(TableInfo*tblinfo,inti,intj,PQExpBufferq)
42464245
{
42474246
int32tmp_typmod;
42484247
intprecision;
@@ -4303,10 +4302,7 @@ _dumpTableAttr70(Archive *fout, TableInfo *tblinfo, int i, int j, PQExpBuffer q)
43034302

43044303
void
43054304
dumpTables(Archive*fout,TableInfo*tblinfo,intnumTables,
4306-
IndInfo*indinfo,intnumIndexes,
4307-
InhInfo*inhinfo,intnumInherits,
4308-
TypeInfo*tinfo,intnumTypes,constchar*tablename,
4309-
constboolaclsSkip,constbooloids,
4305+
constchar*tablename,constboolaclsSkip,
43104306
constboolschemaOnly,constbooldataOnly)
43114307
{
43124308
inti,
@@ -4336,7 +4332,7 @@ dumpTables(Archive *fout, TableInfo *tblinfo, int numTables,
43364332
}
43374333
for (i=0;i<numTables;i++)
43384334
{
4339-
if (!(tblinfo[i].sequence))
4335+
if (tblinfo[i].relkind!=RELKIND_SEQUENCE)
43404336
continue;
43414337
if (!tablename|| (!strcmp(tblinfo[i].relname,tablename))
43424338
|| (serialSeq&& !strcmp(tblinfo[i].relname,serialSeq)))
@@ -4352,7 +4348,7 @@ dumpTables(Archive *fout, TableInfo *tblinfo, int numTables,
43524348

43534349
for (i=0;i<numTables;i++)
43544350
{
4355-
if (tblinfo[i].sequence)/* already dumped */
4351+
if (tblinfo[i].relkind==RELKIND_SEQUENCE)/* already dumped */
43564352
continue;
43574353

43584354
if (!tablename|| (!strcmp(tblinfo[i].relname,tablename))|| (strlen(tablename)==0))
@@ -4415,7 +4411,7 @@ dumpTables(Archive *fout, TableInfo *tblinfo, int numTables,
44154411
if (g_fout->remoteVersion >=70100)
44164412
appendPQExpBuffer(q,"%s",tblinfo[i].atttypedefns[j]);
44174413
else
4418-
_dumpTableAttr70(fout,tblinfo,i,j,q);
4414+
_dumpTableAttr70(tblinfo,i,j,q);
44194415

44204416
/* Default value */
44214417
if (tblinfo[i].adef_expr[j]!=NULL&&tblinfo[i].inhAttrDef[j]==0)

‎src/bin/pg_dump/pg_dump.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: pg_dump.h,v 1.82 2002/04/21 05:21:18 petere Exp $
9+
* $Id: pg_dump.h,v 1.83 2002/04/24 02:44:19 momjian Exp $
1010
*
1111
* Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
1212
*
@@ -99,7 +99,6 @@ typedef struct _tableInfo
9999
* rule may ref things created after the
100100
* base table was created. */
101101
charrelkind;
102-
boolsequence;/* this is redundant with relkind... */
103102
boolhasindex;/* does it have any indexes? */
104103
boolhasoids;/* does it have OIDs? */
105104
intnumatts;/* number of attributes */
@@ -275,10 +274,7 @@ extern void dumpAggs(Archive *fout, AggInfo *agginfo, int numAggregates,
275274
externvoiddumpOprs(Archive*fout,OprInfo*agginfo,intnumOperators,
276275
TypeInfo*tinfo,intnumTypes);
277276
externvoiddumpTables(Archive*fout,TableInfo*tbinfo,intnumTables,
278-
IndInfo*indinfo,intnumIndexes,
279-
InhInfo*inhinfo,intnumInherits,
280-
TypeInfo*tinfo,intnumTypes,constchar*tablename,
281-
constboolacls,constbooloids,
277+
constchar*tablename,constboolacls,
282278
constboolschemaOnly,constbooldataOnly);
283279
externvoiddumpIndexes(Archive*fout,IndInfo*indinfo,intnumIndexes,
284280
TableInfo*tbinfo,intnumTables,constchar*tablename);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp