Commit a9f0e8e5 authored by Stephen Frost's avatar Stephen Frost

In pg_dump, use a bitmap to represent what to include

pg_dump has historically used a simple boolean 'dump' value to indicate
if a given object should be included in the dump or not.  Instead, use
a bitmap which breaks down the components of an object into their
distinct pieces and use that bitmap to only include the components
requested.

This does not include any behavioral change, but is in preperation for
the change to dump out just ACLs for objects in pg_catalog.

Reviews by Alexander Korotkov, Jose Luis Tallon
parent 6c268df1
...@@ -443,7 +443,7 @@ AssignDumpId(DumpableObject *dobj) ...@@ -443,7 +443,7 @@ AssignDumpId(DumpableObject *dobj)
dobj->dumpId = ++lastDumpId; dobj->dumpId = ++lastDumpId;
dobj->name = NULL; /* must be set later */ dobj->name = NULL; /* must be set later */
dobj->namespace = NULL; /* may be set later */ dobj->namespace = NULL; /* may be set later */
dobj->dump = true; /* default assumption */ dobj->dump = DUMP_COMPONENT_ALL; /* default assumption */
dobj->ext_member = false; /* default assumption */ dobj->ext_member = false; /* default assumption */
dobj->dependencies = NULL; dobj->dependencies = NULL;
dobj->nDeps = 0; dobj->nDeps = 0;
......
This diff is collapsed.
...@@ -81,6 +81,18 @@ typedef enum ...@@ -81,6 +81,18 @@ typedef enum
DO_POLICY DO_POLICY
} DumpableObjectType; } DumpableObjectType;
/* component types of an object which can be selected for dumping */
typedef uint32 DumpComponents; /* a bitmask of dump object components */
#define DUMP_COMPONENT_NONE (0)
#define DUMP_COMPONENT_DEFINITION (1 << 0)
#define DUMP_COMPONENT_DATA (1 << 1)
#define DUMP_COMPONENT_COMMENT (1 << 2)
#define DUMP_COMPONENT_SECLABEL (1 << 3)
#define DUMP_COMPONENT_ACL (1 << 4)
#define DUMP_COMPONENT_POLICY (1 << 5)
#define DUMP_COMPONENT_USERMAP (1 << 6)
#define DUMP_COMPONENT_ALL (0xFFFF)
typedef struct _dumpableObject typedef struct _dumpableObject
{ {
DumpableObjectType objType; DumpableObjectType objType;
...@@ -88,7 +100,7 @@ typedef struct _dumpableObject ...@@ -88,7 +100,7 @@ typedef struct _dumpableObject
DumpId dumpId; /* assigned by AssignDumpId() */ DumpId dumpId; /* assigned by AssignDumpId() */
char *name; /* object name (should never be NULL) */ char *name; /* object name (should never be NULL) */
struct _namespaceInfo *namespace; /* containing namespace, or NULL */ struct _namespaceInfo *namespace; /* containing namespace, or NULL */
bool dump; /* true if we want to dump this object */ DumpComponents dump; /* bitmask of components to dump */
bool ext_member; /* true if object is member of extension */ bool ext_member; /* true if object is member of extension */
DumpId *dependencies; /* dumpIds of objects this one depends on */ DumpId *dependencies; /* dumpIds of objects this one depends on */
int nDeps; /* number of valid dependencies */ int nDeps; /* number of valid dependencies */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment