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

Commit183d3cf

Browse files
committed
Rethink order of operations for dumping extension member objects.
My original idea of doing extension member identification duringgetDependencies() didn't work correctly: we have to mark member tables asnot-to-be-dumped rather earlier than that, else their subsidiary objectslike indexes get dumped anyway. Rearrange code to mark them early enough.
1 parent5bc178b commit183d3cf

File tree

3 files changed

+190
-88
lines changed

3 files changed

+190
-88
lines changed

‎src/bin/pg_dump/common.c

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ TableInfo *
7979
getSchemaData(int*numTablesPtr)
8080
{
8181
NamespaceInfo*nsinfo;
82+
ExtensionInfo*extinfo;
8283
AggInfo*agginfo;
8384
InhInfo*inhinfo;
8485
RuleInfo*ruleinfo;
8586
ProcLangInfo*proclanginfo;
8687
CastInfo*castinfo;
87-
ExtensionInfo*extinfo;
8888
OpclassInfo*opcinfo;
8989
OpfamilyInfo*opfinfo;
9090
ConvInfo*convinfo;
@@ -96,12 +96,12 @@ getSchemaData(int *numTablesPtr)
9696
ForeignServerInfo*srvinfo;
9797
DefaultACLInfo*daclinfo;
9898
intnumNamespaces;
99+
intnumExtensions;
99100
intnumAggregates;
100101
intnumInherits;
101102
intnumRules;
102103
intnumProcLangs;
103104
intnumCasts;
104-
intnumExtensions;
105105
intnumOpclasses;
106106
intnumOpfamilies;
107107
intnumConversions;
@@ -117,6 +117,10 @@ getSchemaData(int *numTablesPtr)
117117
write_msg(NULL,"reading schemas\n");
118118
nsinfo=getNamespaces(&numNamespaces);
119119

120+
if (g_verbose)
121+
write_msg(NULL,"reading extensions\n");
122+
extinfo=getExtensions(&numExtensions);
123+
120124
if (g_verbose)
121125
write_msg(NULL,"reading user-defined functions\n");
122126
funinfo=getFuncs(&numFuncs);
@@ -146,6 +150,10 @@ getSchemaData(int *numTablesPtr)
146150
write_msg(NULL,"reading user-defined operator classes\n");
147151
opcinfo=getOpclasses(&numOpclasses);
148152

153+
if (g_verbose)
154+
write_msg(NULL,"reading user-defined operator families\n");
155+
opfinfo=getOpfamilies(&numOpfamilies);
156+
149157
if (g_verbose)
150158
write_msg(NULL,"reading user-defined text search parsers\n");
151159
prsinfo=getTSParsers(&numTSParsers);
@@ -174,14 +182,14 @@ getSchemaData(int *numTablesPtr)
174182
write_msg(NULL,"reading default privileges\n");
175183
daclinfo=getDefaultACLs(&numDefaultACLs);
176184

177-
if (g_verbose)
178-
write_msg(NULL,"reading user-defined operator families\n");
179-
opfinfo=getOpfamilies(&numOpfamilies);
180-
181185
if (g_verbose)
182186
write_msg(NULL,"reading user-defined conversions\n");
183187
convinfo=getConversions(&numConversions);
184188

189+
if (g_verbose)
190+
write_msg(NULL,"reading type casts\n");
191+
castinfo=getCasts(&numCasts);
192+
185193
if (g_verbose)
186194
write_msg(NULL,"reading user-defined tables\n");
187195
tblinfo=getTables(&numTables);
@@ -195,14 +203,14 @@ getSchemaData(int *numTablesPtr)
195203
write_msg(NULL,"reading rewrite rules\n");
196204
ruleinfo=getRules(&numRules);
197205

206+
/*
207+
* Identify extension member objects and mark them as not to be dumped.
208+
* This must happen after reading all objects that can be direct members
209+
* of extensions, but before we begin to process table subsidiary objects.
210+
*/
198211
if (g_verbose)
199-
write_msg(NULL,"reading type casts\n");
200-
castinfo=getCasts(&numCasts);
201-
202-
/* this must be after getTables */
203-
if (g_verbose)
204-
write_msg(NULL,"reading extensions\n");
205-
extinfo=getExtensions(&numExtensions);
212+
write_msg(NULL,"finding extension members\n");
213+
getExtensionMembership(extinfo,numExtensions);
206214

207215
/* Link tables to parents, mark parents of target tables interesting */
208216
if (g_verbose)
@@ -525,9 +533,9 @@ findObjectByDumpId(DumpId dumpId)
525533
* Returns NULL for unknown ID
526534
*
527535
* We use binary search in a sorted list that is built on first call.
528-
* If AssignDumpId() and findObjectByCatalogId() calls were intermixed,
536+
* If AssignDumpId() and findObjectByCatalogId() calls werefreelyintermixed,
529537
* the code would work, but possibly be very slow.In the current usage
530-
* pattern that does not happen, indeed weonly need tobuild the listonce.
538+
* pattern that does not happen, indeed we build the listat most twice.
531539
*/
532540
DumpableObject*
533541
findObjectByCatalogId(CatalogIdcatalogId)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp