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

Commitd217b2c

Browse files
committed
In pg_dump, split "dump" into "dump" and "dump_contains"
Historically, the "dump" component of the namespace has been usedto decide if the objects inside of the namespace should be dumpedalso. Given that "dump" is now a bitmask and may be partial, andwe may want to dump out all components of the namespace object butonly some of the components of objects contained in the namespace,create a "dump_contains" bitmask which will represent what componentsof the objects inside of a namespace should be dumped out.No behavior change here, but in preparation for a change where wewill dump out just the ACLs of objects in pg_catalog, but we mightnot dump out the ACL of the pg_catalog namespace itself (for instance,when it hasn't been changed from the value set at initdb time).Reviews by Alexander Korotkov, Jose Luis Tallon
1 parenta9f0e8e commitd217b2c

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

‎src/bin/pg_dump/pg_dump.c

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,24 +1311,25 @@ selectDumpableNamespace(NamespaceInfo *nsinfo, DumpOptions *dopt)
13111311
*/
13121312

13131313
if (table_include_oids.head != NULL)
1314-
nsinfo->dobj.dump = DUMP_COMPONENT_NONE;
1314+
nsinfo->dobj.dump_contains = nsinfo->dobj.dump = DUMP_COMPONENT_NONE;
13151315
else if (schema_include_oids.head != NULL)
1316-
nsinfo->dobj.dump = simple_oid_list_member(&schema_include_oids,
1317-
nsinfo->dobj.catId.oid) ?
1316+
nsinfo->dobj.dump_contains = nsinfo->dobj.dump =
1317+
simple_oid_list_member(&schema_include_oids,
1318+
nsinfo->dobj.catId.oid) ?
13181319
DUMP_COMPONENT_ALL : DUMP_COMPONENT_NONE;
13191320
else if (strncmp(nsinfo->dobj.name, "pg_", 3) == 0 ||
13201321
strcmp(nsinfo->dobj.name, "information_schema") == 0)
1321-
nsinfo->dobj.dump = DUMP_COMPONENT_NONE;
1322+
nsinfo->dobj.dump_contains = nsinfo->dobj.dump = DUMP_COMPONENT_NONE;
13221323
else
1323-
nsinfo->dobj.dump = DUMP_COMPONENT_ALL;
1324+
nsinfo->dobj.dump_contains = nsinfo->dobj.dump = DUMP_COMPONENT_ALL;
13241325

13251326
/*
13261327
* In any case, a namespace can be excluded by an exclusion switch
13271328
*/
1328-
if (nsinfo->dobj.dump &&
1329+
if (nsinfo->dobj.dump_contains &&
13291330
simple_oid_list_member(&schema_exclude_oids,
13301331
nsinfo->dobj.catId.oid))
1331-
nsinfo->dobj.dump = DUMP_COMPONENT_NONE;
1332+
nsinfo->dobj.dump_contains = nsinfo->dobj.dump = DUMP_COMPONENT_NONE;
13321333
}
13331334

13341335
/*
@@ -1350,7 +1351,7 @@ selectDumpableTable(TableInfo *tbinfo, DumpOptions *dopt)
13501351
tbinfo->dobj.catId.oid) ?
13511352
DUMP_COMPONENT_ALL : DUMP_COMPONENT_NONE;
13521353
else
1353-
tbinfo->dobj.dump = tbinfo->dobj.namespace->dobj.dump;
1354+
tbinfo->dobj.dump = tbinfo->dobj.namespace->dobj.dump_contains;
13541355

13551356
/*
13561357
* In any case, a table can be excluded by an exclusion switch
@@ -1407,7 +1408,8 @@ selectDumpableType(TypeInfo *tyinfo, DumpOptions *dopt)
14071408
if (checkExtensionMembership(&tyinfo->dobj, dopt))
14081409
return;/* extension membership overrides all else */
14091410

1410-
tyinfo->dobj.dump = tyinfo->dobj.namespace->dobj.dump;
1411+
/* Dump based on if the contents of the namespace are being dumped */
1412+
tyinfo->dobj.dump = tyinfo->dobj.namespace->dobj.dump_contains;
14111413
}
14121414

14131415
/*
@@ -1424,6 +1426,7 @@ selectDumpableDefaultACL(DefaultACLInfo *dinfo, DumpOptions *dopt)
14241426
/* Default ACLs can't be extension members */
14251427

14261428
if (dinfo->dobj.namespace)
1429+
/* default ACLs are considered part of the namespace */
14271430
dinfo->dobj.dump = dinfo->dobj.namespace->dobj.dump;
14281431
else
14291432
dinfo->dobj.dump = dopt->include_everything ?
@@ -1530,7 +1533,7 @@ selectDumpableObject(DumpableObject *dobj, DumpOptions *dopt)
15301533
* non-namespace-associated items, dump if we're dumping "everything".
15311534
*/
15321535
if (dobj->namespace)
1533-
dobj->dump = dobj->namespace->dobj.dump;
1536+
dobj->dump = dobj->namespace->dobj.dump_contains;
15341537
else
15351538
dobj->dump = dopt->include_everything ?
15361539
DUMP_COMPONENT_ALL : DUMP_COMPONENT_NONE;

‎src/bin/pg_dump/pg_dump.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ typedef struct _dumpableObject
100100
DumpIddumpId;/* assigned by AssignDumpId() */
101101
char*name;/* object name (should never be NULL) */
102102
struct_namespaceInfo*namespace;/* containing namespace, or NULL */
103-
DumpComponentsdump;/* bitmask of components to dump */
103+
DumpComponentsdump;/* bitmask of components to dump */
104+
DumpComponentsdump_contains;/* as above, but for contained objects */
104105
boolext_member;/* true if object is member of extension */
105106
DumpId*dependencies;/* dumpIds of objects this one depends on */
106107
intnDeps;/* number of valid dependencies */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp