const int compression, ArchiveMode mode, SetupWorkerPtr setupWorkerPtr);
static void _getObjectDescription(PQExpBuffer buf, TocEntry *te,
ArchiveHandle *AH);
-static void _printTocEntry(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt, bool isData, bool acl_pass);
+static void _printTocEntry(ArchiveHandle *AH, TocEntry *te, bool isData, bool acl_pass);
static char *replace_line_endings(const char *str);
static void _doSetFixedOutputState(ArchiveHandle *AH);
static void _doSetSessionAuth(ArchiveHandle *AH, const char *user);
static void processStdStringsEntry(ArchiveHandle *AH, TocEntry *te);
static teReqs _tocEntryRequired(TocEntry *te, teSection curSection, RestoreOptions *ropt);
static bool _tocEntryIsACL(TocEntry *te);
-static void _disableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt);
-static void _enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt);
+static void _disableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te);
+static void _enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te);
static void buildTocEntryArrays(ArchiveHandle *AH);
static void _moveBefore(ArchiveHandle *AH, TocEntry *pos, TocEntry *te);
static int _discoverArchiveFormat(ArchiveHandle *AH);
static OutputContext SaveOutput(ArchiveHandle *AH);
static void RestoreOutput(ArchiveHandle *AH, OutputContext savedContext);
-static int restore_toc_entry(ArchiveHandle *AH, TocEntry *te,
- RestoreOptions *ropt, bool is_parallel);
+static int restore_toc_entry(ArchiveHandle *AH, TocEntry *te, bool is_parallel);
static void restore_toc_entries_prefork(ArchiveHandle *AH);
static void restore_toc_entries_parallel(ArchiveHandle *AH, ParallelState *pstate,
TocEntry *pending_list);
* setup doesn't need to know anything much, so it's defined here.
*/
static void
-setupRestoreWorker(Archive *AHX, DumpOptions *dopt, RestoreOptions *ropt)
+setupRestoreWorker(Archive *AHX)
{
ArchiveHandle *AH = (ArchiveHandle *) AHX;
/* Public */
void
-CloseArchive(Archive *AHX, DumpOptions *dopt)
+CloseArchive(Archive *AHX)
{
int res = 0;
ArchiveHandle *AH = (ArchiveHandle *) AHX;
- (*AH->ClosePtr) (AH, dopt);
+ (*AH->ClosePtr) (AH);
/* Close the output */
if (AH->gzOut)
/* Public */
void
-SetArchiveRestoreOptions(Archive *AHX, RestoreOptions *ropt)
+SetArchiveOptions(Archive *AH, DumpOptions *dopt, RestoreOptions *ropt)
{
- ArchiveHandle *AH = (ArchiveHandle *) AHX;
- TocEntry *te;
- teSection curSection;
+ /* Caller can omit dump options, in which case we synthesize them */
+ if (dopt == NULL && ropt != NULL)
+ dopt = dumpOptionsFromRestoreOptions(ropt);
/* Save options for later access */
+ AH->dopt = dopt;
AH->ropt = ropt;
+}
+
+/* Public */
+void
+ProcessArchiveRestoreOptions(Archive *AHX)
+{
+ ArchiveHandle *AH = (ArchiveHandle *) AHX;
+ RestoreOptions *ropt = AH->public.ropt;
+ TocEntry *te;
+ teSection curSection;
/* Decide which TOC entries will be dumped/restored, and mark them */
curSection = SECTION_PRE_DATA;
RestoreArchive(Archive *AHX)
{
ArchiveHandle *AH = (ArchiveHandle *) AHX;
- RestoreOptions *ropt = AH->ropt;
+ RestoreOptions *ropt = AH->public.ropt;
bool parallel_mode;
TocEntry *te;
OutputContext sav;
Assert(AH->connection == NULL);
/* ParallelBackupStart() will actually fork the processes */
- pstate = ParallelBackupStart(AH, NULL, ropt);
+ pstate = ParallelBackupStart(AH);
restore_toc_entries_parallel(AH, pstate, &pending_list);
ParallelBackupEnd(AH, pstate);
else
{
for (te = AH->toc->next; te != AH->toc; te = te->next)
- (void) restore_toc_entry(AH, te, ropt, false);
+ (void) restore_toc_entry(AH, te, false);
}
/*
else
ahlog(AH, 1, "setting owner and privileges for %s \"%s\"\n",
te->desc, te->tag);
- _printTocEntry(AH, te, ropt, false, true);
+ _printTocEntry(AH, te, false, true);
}
}
* the parallel parent has to make the corresponding status update.
*/
static int
-restore_toc_entry(ArchiveHandle *AH, TocEntry *te,
- RestoreOptions *ropt, bool is_parallel)
+restore_toc_entry(ArchiveHandle *AH, TocEntry *te, bool is_parallel)
{
+ RestoreOptions *ropt = AH->public.ropt;
int status = WORKER_OK;
teReqs reqs;
bool defnDumped;
ahlog(AH, 1, "creating %s \"%s\"\n", te->desc, te->tag);
- _printTocEntry(AH, te, ropt, false, false);
+ _printTocEntry(AH, te, false, false);
defnDumped = true;
if (strcmp(te->desc, "TABLE") == 0)
*/
if (AH->PrintTocDataPtr !=NULL)
{
- _printTocEntry(AH, te, ropt, true, false);
+ _printTocEntry(AH, te, true, false);
if (strcmp(te->desc, "BLOBS") == 0 ||
strcmp(te->desc, "BLOB COMMENTS") == 0)
if (strcmp(te->desc, "BLOB COMMENTS") == 0)
AH->outputKind = OUTPUT_OTHERDATA;
- (*AH->PrintTocDataPtr) (AH, te, ropt);
+ (*AH->PrintTocDataPtr) (AH, te);
AH->outputKind = OUTPUT_SQLCMDS;
}
else
{
- _disableTriggersIfNecessary(AH, te, ropt);
+ _disableTriggersIfNecessary(AH, te);
/* Select owner and schema as necessary */
_becomeOwner(AH, te);
else
AH->outputKind = OUTPUT_OTHERDATA;
- (*AH->PrintTocDataPtr) (AH, te, ropt);
+ (*AH->PrintTocDataPtr) (AH, te);
/*
* Terminate COPY if needed.
if (is_parallel && te->created)
CommitTransaction(&AH->public);
- _enableTriggersIfNecessary(AH, te, ropt);
+ _enableTriggersIfNecessary(AH, te);
}
}
}
{
/* If we haven't already dumped the defn part, do so now */
ahlog(AH, 1, "executing %s %s\n", te->desc, te->tag);
- _printTocEntry(AH, te, ropt, false, false);
+ _printTocEntry(AH, te, false, false);
}
}
}
static void
-_disableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt)
+_disableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te)
{
+ RestoreOptions *ropt = AH->public.ropt;
+
/* This hack is only needed in a data-only restore */
if (!ropt->dataOnly || !ropt->disable_triggers)
return;
}
static void
-_enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt)
+_enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te)
{
+ RestoreOptions *ropt = AH->public.ropt;
+
/* This hack is only needed in a data-only restore */
if (!ropt->dataOnly || !ropt->disable_triggers)
return;
/* Public */
void
-PrintTOCSummary(Archive *AHX, RestoreOptions *ropt)
+PrintTOCSummary(Archive *AHX)
{
ArchiveHandle *AH = (ArchiveHandle *) AHX;
+ RestoreOptions *ropt = AH->public.ropt;
TocEntry *te;
teSection curSection;
OutputContext sav;
void
StartRestoreBlobs(ArchiveHandle *AH)
{
- if (!AH->ropt->single_txn)
+ RestoreOptions *ropt = AH->public.ropt;
+
+ if (!ropt->single_txn)
{
if (AH->connection)
StartTransaction(&AH->public);
void
EndRestoreBlobs(ArchiveHandle *AH)
{
- if (!AH->ropt->single_txn)
+ RestoreOptions *ropt = AH->public.ropt;
+
+ if (!ropt->single_txn)
{
if (AH->connection)
CommitTransaction(&AH->public);
***********/
void
-SortTocFromFile(Archive *AHX, RestoreOptions *ropt)
+SortTocFromFile(Archive *AHX)
{
ArchiveHandle *AH = (ArchiveHandle *) AHX;
+ RestoreOptions *ropt = AH->public.ropt;
FILE *fh;
char buf[100];
bool incomplete_line;
static int
RestoringToDB(ArchiveHandle *AH)
{
- return (AH->ropt && AH->ropt->useDB && AH->connection);
+ RestoreOptions *ropt = AH->public.ropt;
+
+ return (ropt && ropt->useDB && AH->connection);
}
/*
}
void
-WriteDataChunks(ArchiveHandle *AH, DumpOptions *dopt, ParallelState *pstate)
+WriteDataChunks(ArchiveHandle *AH, ParallelState *pstate)
{
TocEntry *te;
DispatchJobForTocEntry(AH, pstate, te, ACT_DUMP);
}
else
- WriteDataChunksForTocEntry(AH, dopt, te);
+ WriteDataChunksForTocEntry(AH, te);
}
EnsureWorkersFinished(AH, pstate);
}
void
-WriteDataChunksForTocEntry(ArchiveHandle *AH, DumpOptions *dopt, TocEntry *te)
+WriteDataChunksForTocEntry(ArchiveHandle *AH, TocEntry *te)
{
StartDataPtr startPtr;
EndDataPtr endPtr;
/*
* The user-provided DataDumper routine needs to call AH->WriteData
*/
- (*te->dataDumper) ((Archive *) AH, dopt, te->dataDumperArg);
+ (*te->dataDumper) ((Archive *) AH, te->dataDumperArg);
if (endPtr != NULL)
(*endPtr) (AH, te);
static void
_doSetFixedOutputState(ArchiveHandle *AH)
{
+ RestoreOptions *ropt = AH->public.ropt;
+
/* Disable statement_timeout since restore is probably slow */
ahprintf(AH, "SET statement_timeout = 0;\n");
AH->public.std_strings ? "on" : "off");
/* Select the role to be used during restore */
- if (AH->ropt && AH->ropt->use_role)
- ahprintf(AH, "SET ROLE %s;\n", fmtId(AH->ropt->use_role));
+ if (ropt && ropt->use_role)
+ ahprintf(AH, "SET ROLE %s;\n", fmtId(ropt->use_role));
/* Make sure function checking is disabled */
ahprintf(AH, "SET check_function_bodies = false;\n");
ahprintf(AH, "SET escape_string_warning = off;\n");
/* Adjust row-security state */
- if (AH->ropt && AH->ropt->enable_row_security)
+ if (ropt && ropt->enable_row_security)
ahprintf(AH, "SET row_security = on;\n");
else
ahprintf(AH, "SET row_security = off;\n");
static void
_becomeOwner(ArchiveHandle *AH, TocEntry *te)
{
- if (AH->ropt && (AH->ropt->noOwner || !AH->ropt->use_setsessauth))
+ RestoreOptions *ropt = AH->public.ropt;
+
+ if (ropt && (ropt->noOwner || !ropt->use_setsessauth))
return;
_becomeUser(AH, te->owner);
static void
_selectTablespace(ArchiveHandle *AH, const char *tablespace)
{
+ RestoreOptions *ropt = AH->public.ropt;
PQExpBuffer qry;
const char *want,
*have;
/* do nothing in --no-tablespaces mode */
- if (AH->ropt->noTablespace)
+ if (ropt->noTablespace)
return;
have = AH->currTablespace;
}
static void
-_printTocEntry(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt, bool isData, bool acl_pass)
+_printTocEntry(ArchiveHandle *AH, TocEntry *te, bool isData, bool acl_pass)
{
+ RestoreOptions *ropt = AH->public.ropt;
+
/* ACLs are dumped only during acl pass */
if (acl_pass)
{
static void
restore_toc_entries_prefork(ArchiveHandle *AH)
{
- RestoreOptions *ropt = AH->ropt;
bool skipped_some;
TocEntry *next_work_item;
next_work_item->dumpId,
next_work_item->desc, next_work_item->tag);
- (void) restore_toc_entry(AH, next_work_item, ropt, false);
+ (void) restore_toc_entry(AH, next_work_item, false);
/* there should be no touch of ready_list here, so pass NULL */
reduce_dependencies(AH, next_work_item, NULL);
static void
restore_toc_entries_postfork(ArchiveHandle *AH, TocEntry *pending_list)
{
- RestoreOptions *ropt = AH->ropt;
+ RestoreOptions *ropt = AH->public.ropt;
TocEntry *te;
ahlog(AH, 2, "entering restore_toc_entries_postfork\n");
{
ahlog(AH, 1, "processing missed item %d %s %s\n",
te->dumpId, te->desc, te->tag);
- (void) restore_toc_entry(AH, te, ropt, false);
+ (void) restore_toc_entry(AH, te, false);
}
/* The ACLs will be handled back in RestoreArchive. */
{
ArchiveHandle *AH = args->AH;
TocEntry *te = args->te;
- RestoreOptions *ropt = AH->ropt;
int status;
_doSetFixedOutputState(AH);
AH->public.n_errors = 0;
/* Restore the TOC item */
- status = restore_toc_entry(AH, te, ropt, true);
+ status = restore_toc_entry(AH, te, true);
return status;
}
*/
if (AH->mode == archModeRead)
{
- RestoreOptions *ropt = AH->ropt;
+ RestoreOptions *ropt = AH->public.ropt;
Assert(AH->connection == NULL);
/* this also sets clone->connection */
static const CatalogId nilCatalogId = {0, 0};
static void help(const char *progname);
-static void setup_connection(Archive *AH, DumpOptions *dopt,
+static void setup_connection(Archive *AH,
const char *dumpencoding, const char *dumpsnapshot,
char *use_role);
static ArchiveFormat parseArchiveFormat(const char *format, ArchiveMode *mode);
SimpleOidList *oids,
bool strict_names);
static NamespaceInfo *findNamespace(Archive *fout, Oid nsoid, Oid objoid);
-static void dumpTableData(Archive *fout, DumpOptions *dopt, TableDataInfo *tdinfo);
+static void dumpTableData(Archive *fout, TableDataInfo *tdinfo);
static void refreshMatViewData(Archive *fout, TableDataInfo *tdinfo);
static void guessConstraintInheritance(TableInfo *tblinfo, int numTables);
-static void dumpComment(Archive *fout, DumpOptions *dopt, const char *target,
+static void dumpComment(Archive *fout, const char *target,
const char *namespace, const char *owner,
CatalogId catalogId, int subid, DumpId dumpId);
static int findComments(Archive *fout, Oid classoid, Oid objoid,
CommentItem **items);
static int collectComments(Archive *fout, CommentItem **items);
-static void dumpSecLabel(Archive *fout, DumpOptions *dopt, const char *target,
+static void dumpSecLabel(Archive *fout, const char *target,
const char *namespace, const char *owner,
CatalogId catalogId, int subid, DumpId dumpId);
static int findSecLabels(Archive *fout, Oid classoid, Oid objoid,
SecLabelItem **items);
static int collectSecLabels(Archive *fout, SecLabelItem **items);
-static void dumpDumpableObject(Archive *fout, DumpOptions *dopt, DumpableObject *dobj);
-static void dumpNamespace(Archive *fout, DumpOptions *dopt, NamespaceInfo *nspinfo);
-static void dumpExtension(Archive *fout, DumpOptions *dopt, ExtensionInfo *extinfo);
-static void dumpType(Archive *fout, DumpOptions *dopt, TypeInfo *tyinfo);
-static void dumpBaseType(Archive *fout, DumpOptions *dopt, TypeInfo *tyinfo);
-static void dumpEnumType(Archive *fout, DumpOptions *dopt, TypeInfo *tyinfo);
-static void dumpRangeType(Archive *fout, DumpOptions *dopt, TypeInfo *tyinfo);
-static void dumpUndefinedType(Archive *fout, DumpOptions *dopt, TypeInfo *tyinfo);
-static void dumpDomain(Archive *fout, DumpOptions *dopt, TypeInfo *tyinfo);
-static void dumpCompositeType(Archive *fout, DumpOptions *dopt, TypeInfo *tyinfo);
+static void dumpDumpableObject(Archive *fout, DumpableObject *dobj);
+static void dumpNamespace(Archive *fout, NamespaceInfo *nspinfo);
+static void dumpExtension(Archive *fout, ExtensionInfo *extinfo);
+static void dumpType(Archive *fout, TypeInfo *tyinfo);
+static void dumpBaseType(Archive *fout, TypeInfo *tyinfo);
+static void dumpEnumType(Archive *fout, TypeInfo *tyinfo);
+static void dumpRangeType(Archive *fout, TypeInfo *tyinfo);
+static void dumpUndefinedType(Archive *fout, TypeInfo *tyinfo);
+static void dumpDomain(Archive *fout, TypeInfo *tyinfo);
+static void dumpCompositeType(Archive *fout, TypeInfo *tyinfo);
static void dumpCompositeTypeColComments(Archive *fout, TypeInfo *tyinfo);
-static void dumpShellType(Archive *fout, DumpOptions *dopt, ShellTypeInfo *stinfo);
-static void dumpProcLang(Archive *fout, DumpOptions *dopt, ProcLangInfo *plang);
-static void dumpFunc(Archive *fout, DumpOptions *dopt, FuncInfo *finfo);
-static void dumpCast(Archive *fout, DumpOptions *dopt, CastInfo *cast);
-static void dumpTransform(Archive *fout, DumpOptions *dopt, TransformInfo *transform);
-static void dumpOpr(Archive *fout, DumpOptions *dopt, OprInfo *oprinfo);
-static void dumpOpclass(Archive *fout, DumpOptions *dopt, OpclassInfo *opcinfo);
-static void dumpOpfamily(Archive *fout, DumpOptions *dopt, OpfamilyInfo *opfinfo);
-static void dumpCollation(Archive *fout, DumpOptions *dopt, CollInfo *convinfo);
-static void dumpConversion(Archive *fout, DumpOptions *dopt, ConvInfo *convinfo);
-static void dumpRule(Archive *fout, DumpOptions *dopt, RuleInfo *rinfo);
-static void dumpAgg(Archive *fout, DumpOptions *dopt, AggInfo *agginfo);
-static void dumpTrigger(Archive *fout, DumpOptions *dopt, TriggerInfo *tginfo);
-static void dumpEventTrigger(Archive *fout, DumpOptions *dopt, EventTriggerInfo *evtinfo);
-static void dumpTable(Archive *fout, DumpOptions *dopt, TableInfo *tbinfo);
-static void dumpTableSchema(Archive *fout, DumpOptions *dopt, TableInfo *tbinfo);
-static void dumpAttrDef(Archive *fout, DumpOptions *dopt, AttrDefInfo *adinfo);
-static void dumpSequence(Archive *fout, DumpOptions *dopt, TableInfo *tbinfo);
+static void dumpShellType(Archive *fout, ShellTypeInfo *stinfo);
+static void dumpProcLang(Archive *fout, ProcLangInfo *plang);
+static void dumpFunc(Archive *fout, FuncInfo *finfo);
+static void dumpCast(Archive *fout, CastInfo *cast);
+static void dumpTransform(Archive *fout, TransformInfo *transform);
+static void dumpOpr(Archive *fout, OprInfo *oprinfo);
+static void dumpOpclass(Archive *fout, OpclassInfo *opcinfo);
+static void dumpOpfamily(Archive *fout, OpfamilyInfo *opfinfo);
+static void dumpCollation(Archive *fout, CollInfo *convinfo);
+static void dumpConversion(Archive *fout, ConvInfo *convinfo);
+static void dumpRule(Archive *fout, RuleInfo *rinfo);
+static void dumpAgg(Archive *fout, AggInfo *agginfo);
+static void dumpTrigger(Archive *fout, TriggerInfo *tginfo);
+static void dumpEventTrigger(Archive *fout, EventTriggerInfo *evtinfo);
+static void dumpTable(Archive *fout, TableInfo *tbinfo);
+static void dumpTableSchema(Archive *fout, TableInfo *tbinfo);
+static void dumpAttrDef(Archive *fout, AttrDefInfo *adinfo);
+static void dumpSequence(Archive *fout, TableInfo *tbinfo);
static void dumpSequenceData(Archive *fout, TableDataInfo *tdinfo);
-static void dumpIndex(Archive *fout, DumpOptions *dopt, IndxInfo *indxinfo);
-static void dumpConstraint(Archive *fout, DumpOptions *dopt, ConstraintInfo *coninfo);
-static void dumpTableConstraintComment(Archive *fout, DumpOptions *dopt, ConstraintInfo *coninfo);
-static void dumpTSParser(Archive *fout, DumpOptions *dopt, TSParserInfo *prsinfo);
-static void dumpTSDictionary(Archive *fout, DumpOptions *dopt, TSDictInfo *dictinfo);
-static void dumpTSTemplate(Archive *fout, DumpOptions *dopt, TSTemplateInfo *tmplinfo);
-static void dumpTSConfig(Archive *fout, DumpOptions *dopt, TSConfigInfo *cfginfo);
-static void dumpForeignDataWrapper(Archive *fout, DumpOptions *dopt, FdwInfo *fdwinfo);
-static void dumpForeignServer(Archive *fout, DumpOptions *dopt, ForeignServerInfo *srvinfo);
+static void dumpIndex(Archive *fout, IndxInfo *indxinfo);
+static void dumpConstraint(Archive *fout, ConstraintInfo *coninfo);
+static void dumpTableConstraintComment(Archive *fout, ConstraintInfo *coninfo);
+static void dumpTSParser(Archive *fout, TSParserInfo *prsinfo);
+static void dumpTSDictionary(Archive *fout, TSDictInfo *dictinfo);
+static void dumpTSTemplate(Archive *fout, TSTemplateInfo *tmplinfo);
+static void dumpTSConfig(Archive *fout, TSConfigInfo *cfginfo);
+static void dumpForeignDataWrapper(Archive *fout, FdwInfo *fdwinfo);
+static void dumpForeignServer(Archive *fout, ForeignServerInfo *srvinfo);
static void dumpUserMappings(Archive *fout,
const char *servername, const char *namespace,
const char *owner, CatalogId catalogId, DumpId dumpId);
-static void dumpDefaultACL(Archive *fout, DumpOptions *dopt, DefaultACLInfo *daclinfo);
+static void dumpDefaultACL(Archive *fout, DefaultACLInfo *daclinfo);
-static void dumpACL(Archive *fout, DumpOptions *dopt, CatalogId objCatId, DumpId objDumpId,
+static void dumpACL(Archive *fout, CatalogId objCatId, DumpId objDumpId,
const char *type, const char *name, const char *subname,
const char *tag, const char *nspname, const char *owner,
const char *acls);
static char *getFormattedTypeName(Archive *fout, Oid oid, OidOptions opts);
static char *myFormatType(const char *typname, int32 typmod);
static void getBlobs(Archive *fout);
-static void dumpBlob(Archive *fout, DumpOptions *dopt, BlobInfo *binfo);
-static int dumpBlobs(Archive *fout, DumpOptions *dopt, void *arg);
-static void dumpPolicy(Archive *fout, DumpOptions *dopt, PolicyInfo *polinfo);
-static void dumpDatabase(Archive *AH, DumpOptions *dopt);
+static void dumpBlob(Archive *fout, BlobInfo *binfo);
+static int dumpBlobs(Archive *fout, void *arg);
+static void dumpPolicy(Archive *fout, PolicyInfo *polinfo);
+static void dumpDatabase(Archive *AH);
static void dumpEncoding(Archive *AH);
static void dumpStdStrings(Archive *AH);
static void binary_upgrade_set_type_oids_by_type_oid(Archive *fout,
const char *reloptions, const char *prefix);
static char *get_synchronized_snapshot(Archive *fout);
static PGresult *ExecuteSqlQueryForSingleRow(Archive *fout, char *query);
-static void setupDumpWorker(Archive *AHX, DumpOptions *dopt, RestoreOptions *ropt);
+static void setupDumpWorker(Archive *AHX);
int
fout = CreateArchive(filename, archiveFormat, compressLevel, archiveMode,
setupDumpWorker);
+ /* Make dump options accessible right away */
+ SetArchiveOptions(fout, &dopt, NULL);
+
/* Register the cleanup hook */
on_exit_close_archive(fout);
* death.
*/
ConnectDatabase(fout, dopt.dbname, dopt.pghost, dopt.pgport, dopt.username, prompt_password);
- setup_connection(fout, &dopt, dumpencoding, dumpsnapshot, use_role);
+ setup_connection(fout, dumpencoding, dumpsnapshot, use_role);
/*
* Disable security label support if server version < v9.1.x (prevents
* Now scan the database and create DumpableObject structs for all the
* objects we intend to dump.
*/
- tblinfo = getSchemaData(fout, &dopt, &numTables);
+ tblinfo = getSchemaData(fout, &numTables);
if (fout->remoteVersion < 80400)
guessConstraintInheritance(tblinfo, numTables);
/* The database item is always next, unless we don't want it at all */
if (dopt.include_everything && !dopt.dataOnly)
- dumpDatabase(fout, &dopt);
+ dumpDatabase(fout);
/* Now the rearrangeable objects. */
for (i = 0; i < numObjs; i++)
- dumpDumpableObject(fout, &dopt, dobjs[i]);
+ dumpDumpableObject(fout, dobjs[i]);
/*
* Set up options info to ensure we dump what we want.
ropt->suppressDumpWarnings = true; /* We've already shown them */
- SetArchiveRestoreOptions(fout, ropt);
+ SetArchiveOptions(fout, &dopt, ropt);
+
+ /* Mark which entries should be output */
+ ProcessArchiveRestoreOptions(fout);
/*
* The archive's TOC entries are now marked as to which ones will actually
if (plainText)
RestoreArchive(fout);
- CloseArchive(fout, &dopt);
+ CloseArchive(fout);
exit_nicely(0);
}
}
static void
-setup_connection(Archive *AH, DumpOptions *dopt, const char *dumpencoding,
+setup_connection(Archive *AH, const char *dumpencoding,
const char *dumpsnapshot, char *use_role)
{
+ DumpOptions *dopt = AH->dopt;
PGconn *conn = GetConnection(AH);
const char *std_strings;
}
static void
-setupDumpWorker(Archive *AHX, DumpOptions *dopt, RestoreOptions *ropt)
+setupDumpWorker(Archive *AHX)
{
- setup_connection(AHX, dopt, NULL, NULL, NULL);
+ setup_connection(AHX, NULL, NULL, NULL);
}
static char *
*/
static int
-dumpTableData_copy(Archive *fout, DumpOptions *dopt, void *dcontext)
+dumpTableData_copy(Archive *fout, void *dcontext)
{
TableDataInfo *tdinfo = (TableDataInfo *) dcontext;
TableInfo *tbinfo = tdinfo->tdtable;
* E'' strings, or dollar-quoted strings. So don't emit anything like that.
*/
static int
-dumpTableData_insert(Archive *fout, DumpOptions *dopt, void *dcontext)
+dumpTableData_insert(Archive *fout, void *dcontext)
{
TableDataInfo *tdinfo = (TableDataInfo *) dcontext;
TableInfo *tbinfo = tdinfo->tdtable;
const char *classname = tbinfo->dobj.name;
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer q = createPQExpBuffer();
PQExpBuffer insertStmt = NULL;
PGresult *res;
* Actually, this just makes an ArchiveEntry for the table contents.
*/
static void
-dumpTableData(Archive *fout, DumpOptions *dopt, TableDataInfo *tdinfo)
+dumpTableData(Archive *fout, TableDataInfo *tdinfo)
{
+ DumpOptions *dopt = fout->dopt;
TableInfo *tbinfo = tdinfo->tdtable;
PQExpBuffer copyBuf = createPQExpBuffer();
PQExpBuffer clistBuf = createPQExpBuffer();
* dump the database definition
*/
static void
-dumpDatabase(Archive *fout, DumpOptions *dopt)
+dumpDatabase(Archive *fout)
{
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer dbQry = createPQExpBuffer();
PQExpBuffer delQry = createPQExpBuffer();
PQExpBuffer creaQry = createPQExpBuffer();
{
resetPQExpBuffer(dbQry);
appendPQExpBuffer(dbQry, "DATABASE %s", fmtId(datname));
- dumpComment(fout, dopt, dbQry->data, NULL, "",
+ dumpComment(fout, dbQry->data, NULL, "",
dbCatId, 0, dbDumpId);
}
* dump the definition (metadata) of the given large object
*/
static void
-dumpBlob(Archive *fout, DumpOptions *dopt, BlobInfo *binfo)
+dumpBlob(Archive *fout, BlobInfo *binfo)
{
PQExpBuffer cquery = createPQExpBuffer();
PQExpBuffer dquery = createPQExpBuffer();
appendPQExpBuffer(cquery, "LARGE OBJECT %s", binfo->dobj.name);
/* Dump comment if any */
- dumpComment(fout, dopt, cquery->data,
+ dumpComment(fout, cquery->data,
NULL, binfo->rolname,
binfo->dobj.catId, 0, binfo->dobj.dumpId);
/* Dump security label if any */
- dumpSecLabel(fout, dopt, cquery->data,
+ dumpSecLabel(fout, cquery->data,
NULL, binfo->rolname,
binfo->dobj.catId, 0, binfo->dobj.dumpId);
/* Dump ACL if any */
if (binfo->blobacl)
- dumpACL(fout, dopt, binfo->dobj.catId, binfo->dobj.dumpId, "LARGE OBJECT",
+ dumpACL(fout, binfo->dobj.catId, binfo->dobj.dumpId, "LARGE OBJECT",
binfo->dobj.name, NULL, cquery->data,
NULL, binfo->rolname, binfo->blobacl);
* dump the data contents of all large objects
*/
static int
-dumpBlobs(Archive *fout, DumpOptions *dopt, void *arg)
+dumpBlobs(Archive *fout, void *arg)
{
const char *blobQry;
const char *blobFetchQry;
* dump the definition of the given policy
*/
static void
-dumpPolicy(Archive *fout, DumpOptions *dopt, PolicyInfo *polinfo)
+dumpPolicy(Archive *fout, PolicyInfo *polinfo)
{
+ DumpOptions *dopt = fout->dopt;
TableInfo *tbinfo = polinfo->poltable;
PQExpBuffer query;
PQExpBuffer delqry;
* numExtensions is set to the number of extensions read in
*/
ExtensionInfo *
-getExtensions(Archive *fout, DumpOptions *dopt, int *numExtensions)
+getExtensions(Archive *fout, int *numExtensions)
{
+ DumpOptions *dopt = fout->dopt;
PGresult *res;
int ntups;
int i;
* numAggs is set to the number of aggregates read in
*/
AggInfo *
-getAggregates(Archive *fout, DumpOptions *dopt, int *numAggs)
+getAggregates(Archive *fout, int *numAggs)
{
+ DumpOptions *dopt = fout->dopt;
PGresult *res;
int ntups;
int i;
* numFuncs is set to the number of functions read in
*/
FuncInfo *
-getFuncs(Archive *fout, DumpOptions *dopt, int *numFuncs)
+getFuncs(Archive *fout, int *numFuncs)
{
+ DumpOptions *dopt = fout->dopt;
PGresult *res;
int ntups;
int i;
* numTables is set to the number of tables read in
*/
TableInfo *
-getTables(Archive *fout, DumpOptions *dopt, int *numTables)
+getTables(Archive *fout, int *numTables)
{
+ DumpOptions *dopt = fout->dopt;
PGresult *res;
int ntups;
int i;
* numCasts is set to the number of casts read in
*/
CastInfo *
-getCasts(Archive *fout, DumpOptions *dopt, int *numCasts)
+getCasts(Archive *fout, int *numCasts)
{
+ DumpOptions *dopt = fout->dopt;
PGresult *res;
int ntups;
int i;
* modifies tblinfo
*/
void
-getTableAttrs(Archive *fout, DumpOptions *dopt, TableInfo *tblinfo, int numTables)
+getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables)
{
+ DumpOptions *dopt = fout->dopt;
int i,
j;
PQExpBuffer q = createPQExpBuffer();
* numDefaultACLs is set to the number of ACLs read in
*/
DefaultACLInfo *
-getDefaultACLs(Archive *fout, DumpOptions *dopt, int *numDefaultACLs)
+getDefaultACLs(Archive *fout, int *numDefaultACLs)
{
+ DumpOptions *dopt = fout->dopt;
DefaultACLInfo *daclinfo;
PQExpBuffer query;
PGresult *res;
* calling ArchiveEntry() for the specified object.
*/
static void
-dumpComment(Archive *fout, DumpOptions *dopt, const char *target,
+dumpComment(Archive *fout, const char *target,
const char *namespace, const char *owner,
CatalogId catalogId, int subid, DumpId dumpId)
{
+ DumpOptions *dopt = fout->dopt;
CommentItem *comments;
int ncomments;
* and its columns.
*/
static void
-dumpTableComment(Archive *fout, DumpOptions *dopt, TableInfo *tbinfo,
+dumpTableComment(Archive *fout, TableInfo *tbinfo,
const char *reltypename)
{
+ DumpOptions *dopt = fout->dopt;
CommentItem *comments;
int ncomments;
PQExpBuffer query;
* ArchiveEntries (TOC objects) for each object to be dumped.
*/
static void
-dumpDumpableObject(Archive *fout, DumpOptions *dopt, DumpableObject *dobj)
+dumpDumpableObject(Archive *fout, DumpableObject *dobj)
{
switch (dobj->objType)
{
case DO_NAMESPACE:
- dumpNamespace(fout, dopt, (NamespaceInfo *) dobj);
+ dumpNamespace(fout, (NamespaceInfo *) dobj);
break;
case DO_EXTENSION:
- dumpExtension(fout, dopt, (ExtensionInfo *) dobj);
+ dumpExtension(fout, (ExtensionInfo *) dobj);
break;
case DO_TYPE:
- dumpType(fout, dopt, (TypeInfo *) dobj);
+ dumpType(fout, (TypeInfo *) dobj);
break;
case DO_SHELL_TYPE:
- dumpShellType(fout, dopt, (ShellTypeInfo *) dobj);
+ dumpShellType(fout, (ShellTypeInfo *) dobj);
break;
case DO_FUNC:
- dumpFunc(fout, dopt, (FuncInfo *) dobj);
+ dumpFunc(fout, (FuncInfo *) dobj);
break;
case DO_AGG:
- dumpAgg(fout, dopt, (AggInfo *) dobj);
+ dumpAgg(fout, (AggInfo *) dobj);
break;
case DO_OPERATOR:
- dumpOpr(fout, dopt, (OprInfo *) dobj);
+ dumpOpr(fout, (OprInfo *) dobj);
break;
case DO_OPCLASS:
- dumpOpclass(fout, dopt, (OpclassInfo *) dobj);
+ dumpOpclass(fout, (OpclassInfo *) dobj);
break;
case DO_OPFAMILY:
- dumpOpfamily(fout, dopt, (OpfamilyInfo *) dobj);
+ dumpOpfamily(fout, (OpfamilyInfo *) dobj);
break;
case DO_COLLATION:
- dumpCollation(fout, dopt, (CollInfo *) dobj);
+ dumpCollation(fout, (CollInfo *) dobj);
break;
case DO_CONVERSION:
- dumpConversion(fout, dopt, (ConvInfo *) dobj);
+ dumpConversion(fout, (ConvInfo *) dobj);
break;
case DO_TABLE:
- dumpTable(fout, dopt, (TableInfo *) dobj);
+ dumpTable(fout, (TableInfo *) dobj);
break;
case DO_ATTRDEF:
- dumpAttrDef(fout, dopt, (AttrDefInfo *) dobj);
+ dumpAttrDef(fout, (AttrDefInfo *) dobj);
break;
case DO_INDEX:
- dumpIndex(fout, dopt, (IndxInfo *) dobj);
+ dumpIndex(fout, (IndxInfo *) dobj);
break;
case DO_REFRESH_MATVIEW:
refreshMatViewData(fout, (TableDataInfo *) dobj);
break;
case DO_RULE:
- dumpRule(fout, dopt, (RuleInfo *) dobj);
+ dumpRule(fout, (RuleInfo *) dobj);
break;
case DO_TRIGGER:
- dumpTrigger(fout, dopt, (TriggerInfo *) dobj);
+ dumpTrigger(fout, (TriggerInfo *) dobj);
break;
case DO_EVENT_TRIGGER:
- dumpEventTrigger(fout, dopt, (EventTriggerInfo *) dobj);
+ dumpEventTrigger(fout, (EventTriggerInfo *) dobj);
break;
case DO_CONSTRAINT:
- dumpConstraint(fout, dopt, (ConstraintInfo *) dobj);
+ dumpConstraint(fout, (ConstraintInfo *) dobj);
break;
case DO_FK_CONSTRAINT:
- dumpConstraint(fout, dopt, (ConstraintInfo *) dobj);
+ dumpConstraint(fout, (ConstraintInfo *) dobj);
break;
case DO_PROCLANG:
- dumpProcLang(fout, dopt, (ProcLangInfo *) dobj);
+ dumpProcLang(fout, (ProcLangInfo *) dobj);
break;
case DO_CAST:
- dumpCast(fout, dopt, (CastInfo *) dobj);
+ dumpCast(fout, (CastInfo *) dobj);
break;
case DO_TRANSFORM:
- dumpTransform(fout, dopt, (TransformInfo *) dobj);
+ dumpTransform(fout, (TransformInfo *) dobj);
break;
case DO_TABLE_DATA:
if (((TableDataInfo *) dobj)->tdtable->relkind == RELKIND_SEQUENCE)
dumpSequenceData(fout, (TableDataInfo *) dobj);
else
- dumpTableData(fout, dopt, (TableDataInfo *) dobj);
+ dumpTableData(fout, (TableDataInfo *) dobj);
break;
case DO_DUMMY_TYPE:
/* table rowtypes and array types are never dumped separately */
break;
case DO_TSPARSER:
- dumpTSParser(fout, dopt, (TSParserInfo *) dobj);
+ dumpTSParser(fout, (TSParserInfo *) dobj);
break;
case DO_TSDICT:
- dumpTSDictionary(fout, dopt, (TSDictInfo *) dobj);
+ dumpTSDictionary(fout, (TSDictInfo *) dobj);
break;
case DO_TSTEMPLATE:
- dumpTSTemplate(fout, dopt, (TSTemplateInfo *) dobj);
+ dumpTSTemplate(fout, (TSTemplateInfo *) dobj);
break;
case DO_TSCONFIG:
- dumpTSConfig(fout, dopt, (TSConfigInfo *) dobj);
+ dumpTSConfig(fout, (TSConfigInfo *) dobj);
break;
case DO_FDW:
- dumpForeignDataWrapper(fout, dopt, (FdwInfo *) dobj);
+ dumpForeignDataWrapper(fout, (FdwInfo *) dobj);
break;
case DO_FOREIGN_SERVER:
- dumpForeignServer(fout, dopt, (ForeignServerInfo *) dobj);
+ dumpForeignServer(fout, (ForeignServerInfo *) dobj);
break;
case DO_DEFAULT_ACL:
- dumpDefaultACL(fout, dopt, (DefaultACLInfo *) dobj);
+ dumpDefaultACL(fout, (DefaultACLInfo *) dobj);
break;
case DO_BLOB:
- dumpBlob(fout, dopt, (BlobInfo *) dobj);
+ dumpBlob(fout, (BlobInfo *) dobj);
break;
case DO_BLOB_DATA:
ArchiveEntry(fout, dobj->catId, dobj->dumpId,
dumpBlobs, NULL);
break;
case DO_POLICY:
- dumpPolicy(fout, dopt, (PolicyInfo *) dobj);
+ dumpPolicy(fout, (PolicyInfo *) dobj);
break;
case DO_PRE_DATA_BOUNDARY:
case DO_POST_DATA_BOUNDARY:
* writes out to fout the queries to recreate a user-defined namespace
*/
static void
-dumpNamespace(Archive *fout, DumpOptions *dopt, NamespaceInfo *nspinfo)
+dumpNamespace(Archive *fout, NamespaceInfo *nspinfo)
{
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer q;
PQExpBuffer delq;
PQExpBuffer labelq;
NULL, NULL);
/* Dump Schema Comments and Security Labels */
- dumpComment(fout, dopt, labelq->data,
+ dumpComment(fout, labelq->data,
NULL, nspinfo->rolname,
nspinfo->dobj.catId, 0, nspinfo->dobj.dumpId);
- dumpSecLabel(fout, dopt, labelq->data,
+ dumpSecLabel(fout, labelq->data,
NULL, nspinfo->rolname,
nspinfo->dobj.catId, 0, nspinfo->dobj.dumpId);
- dumpACL(fout, dopt, nspinfo->dobj.catId, nspinfo->dobj.dumpId, "SCHEMA",
+ dumpACL(fout, nspinfo->dobj.catId, nspinfo->dobj.dumpId, "SCHEMA",
qnspname, NULL, nspinfo->dobj.name, NULL,
nspinfo->rolname, nspinfo->nspacl);
* writes out to fout the queries to recreate an extension
*/
static void
-dumpExtension(Archive *fout, DumpOptions *dopt, ExtensionInfo *extinfo)
+dumpExtension(Archive *fout, ExtensionInfo *extinfo)
{
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer q;
PQExpBuffer delq;
PQExpBuffer labelq;
NULL, NULL);
/* Dump Extension Comments and Security Labels */
- dumpComment(fout, dopt, labelq->data,
+ dumpComment(fout, labelq->data,
NULL, "",
extinfo->dobj.catId, 0, extinfo->dobj.dumpId);
- dumpSecLabel(fout, dopt, labelq->data,
+ dumpSecLabel(fout, labelq->data,
NULL, "",
extinfo->dobj.catId, 0, extinfo->dobj.dumpId);
* writes out to fout the queries to recreate a user-defined type
*/
static void
-dumpType(Archive *fout, DumpOptions *dopt, TypeInfo *tyinfo)
+dumpType(Archive *fout, TypeInfo *tyinfo)
{
+ DumpOptions *dopt = fout->dopt;
+
/* Skip if not to be dumped */
if (!tyinfo->dobj.dump || dopt->dataOnly)
return;
/* Dump out in proper style */
if (tyinfo->typtype == TYPTYPE_BASE)
- dumpBaseType(fout, dopt, tyinfo);
+ dumpBaseType(fout, tyinfo);
else if (tyinfo->typtype == TYPTYPE_DOMAIN)
- dumpDomain(fout, dopt, tyinfo);
+ dumpDomain(fout, tyinfo);
else if (tyinfo->typtype == TYPTYPE_COMPOSITE)
- dumpCompositeType(fout, dopt, tyinfo);
+ dumpCompositeType(fout, tyinfo);
else if (tyinfo->typtype == TYPTYPE_ENUM)
- dumpEnumType(fout, dopt, tyinfo);
+ dumpEnumType(fout, tyinfo);
else if (tyinfo->typtype == TYPTYPE_RANGE)
- dumpRangeType(fout, dopt, tyinfo);
+ dumpRangeType(fout, tyinfo);
else if (tyinfo->typtype == TYPTYPE_PSEUDO && !tyinfo->isDefined)
- dumpUndefinedType(fout, dopt, tyinfo);
+ dumpUndefinedType(fout, tyinfo);
else
write_msg(NULL, "WARNING: typtype of data type \"%s\" appears to be invalid\n",
tyinfo->dobj.name);
* writes out to fout the queries to recreate a user-defined enum type
*/
static void
-dumpEnumType(Archive *fout, DumpOptions *dopt, TypeInfo *tyinfo)
+dumpEnumType(Archive *fout, TypeInfo *tyinfo)
{
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer q = createPQExpBuffer();
PQExpBuffer delq = createPQExpBuffer();
PQExpBuffer labelq = createPQExpBuffer();
NULL, NULL);
/* Dump Type Comments and Security Labels */
- dumpComment(fout, dopt, labelq->data,
+ dumpComment(fout, labelq->data,
tyinfo->dobj.namespace->dobj.name, tyinfo->rolname,
tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId);
- dumpSecLabel(fout, dopt, labelq->data,
+ dumpSecLabel(fout, labelq->data,
tyinfo->dobj.namespace->dobj.name, tyinfo->rolname,
tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId);
- dumpACL(fout, dopt, tyinfo->dobj.catId, tyinfo->dobj.dumpId, "TYPE",
+ dumpACL(fout, tyinfo->dobj.catId, tyinfo->dobj.dumpId, "TYPE",
qtypname, NULL, tyinfo->dobj.name,
tyinfo->dobj.namespace->dobj.name,
tyinfo->rolname, tyinfo->typacl);
* writes out to fout the queries to recreate a user-defined range type
*/
static void
-dumpRangeType(Archive *fout, DumpOptions *dopt, TypeInfo *tyinfo)
+dumpRangeType(Archive *fout, TypeInfo *tyinfo)
{
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer q = createPQExpBuffer();
PQExpBuffer delq = createPQExpBuffer();
PQExpBuffer labelq = createPQExpBuffer();
NULL, NULL);
/* Dump Type Comments and Security Labels */
- dumpComment(fout, dopt, labelq->data,
+ dumpComment(fout, labelq->data,
tyinfo->dobj.namespace->dobj.name, tyinfo->rolname,
tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId);
- dumpSecLabel(fout, dopt, labelq->data,
+ dumpSecLabel(fout, labelq->data,
tyinfo->dobj.namespace->dobj.name, tyinfo->rolname,
tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId);
- dumpACL(fout, dopt, tyinfo->dobj.catId, tyinfo->dobj.dumpId, "TYPE",
+ dumpACL(fout, tyinfo->dobj.catId, tyinfo->dobj.dumpId, "TYPE",
qtypname, NULL, tyinfo->dobj.name,
tyinfo->dobj.namespace->dobj.name,
tyinfo->rolname, tyinfo->typacl);
* depending on it.
*/
static void
-dumpUndefinedType(Archive *fout, DumpOptions *dopt, TypeInfo *tyinfo)
+dumpUndefinedType(Archive *fout, TypeInfo *tyinfo)
{
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer q = createPQExpBuffer();
PQExpBuffer delq = createPQExpBuffer();
PQExpBuffer labelq = createPQExpBuffer();
NULL, NULL);
/* Dump Type Comments and Security Labels */
- dumpComment(fout, dopt, labelq->data,
+ dumpComment(fout, labelq->data,
tyinfo->dobj.namespace->dobj.name, tyinfo->rolname,
tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId);
- dumpSecLabel(fout, dopt, labelq->data,
+ dumpSecLabel(fout, labelq->data,
tyinfo->dobj.namespace->dobj.name, tyinfo->rolname,
tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId);
- dumpACL(fout, dopt, tyinfo->dobj.catId, tyinfo->dobj.dumpId, "TYPE",
+ dumpACL(fout, tyinfo->dobj.catId, tyinfo->dobj.dumpId, "TYPE",
qtypname, NULL, tyinfo->dobj.name,
tyinfo->dobj.namespace->dobj.name,
tyinfo->rolname, tyinfo->typacl);
* writes out to fout the queries to recreate a user-defined base type
*/
static void
-dumpBaseType(Archive *fout, DumpOptions *dopt, TypeInfo *tyinfo)
+dumpBaseType(Archive *fout, TypeInfo *tyinfo)
{
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer q = createPQExpBuffer();
PQExpBuffer delq = createPQExpBuffer();
PQExpBuffer labelq = createPQExpBuffer();
NULL, NULL);
/* Dump Type Comments and Security Labels */
- dumpComment(fout, dopt, labelq->data,
+ dumpComment(fout, labelq->data,
tyinfo->dobj.namespace->dobj.name, tyinfo->rolname,
tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId);
- dumpSecLabel(fout, dopt, labelq->data,
+ dumpSecLabel(fout, labelq->data,
tyinfo->dobj.namespace->dobj.name, tyinfo->rolname,
tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId);
- dumpACL(fout, dopt, tyinfo->dobj.catId, tyinfo->dobj.dumpId, "TYPE",
+ dumpACL(fout, tyinfo->dobj.catId, tyinfo->dobj.dumpId, "TYPE",
qtypname, NULL, tyinfo->dobj.name,
tyinfo->dobj.namespace->dobj.name,
tyinfo->rolname, tyinfo->typacl);
* writes out to fout the queries to recreate a user-defined domain
*/
static void
-dumpDomain(Archive *fout, DumpOptions *dopt, TypeInfo *tyinfo)
+dumpDomain(Archive *fout, TypeInfo *tyinfo)
{
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer q = createPQExpBuffer();
PQExpBuffer delq = createPQExpBuffer();
PQExpBuffer labelq = createPQExpBuffer();
NULL, NULL);
/* Dump Domain Comments and Security Labels */
- dumpComment(fout, dopt, labelq->data,
+ dumpComment(fout, labelq->data,
tyinfo->dobj.namespace->dobj.name, tyinfo->rolname,
tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId);
- dumpSecLabel(fout, dopt, labelq->data,
+ dumpSecLabel(fout, labelq->data,
tyinfo->dobj.namespace->dobj.name, tyinfo->rolname,
tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId);
- dumpACL(fout, dopt, tyinfo->dobj.catId, tyinfo->dobj.dumpId, "TYPE",
+ dumpACL(fout, tyinfo->dobj.catId, tyinfo->dobj.dumpId, "TYPE",
qtypname, NULL, tyinfo->dobj.name,
tyinfo->dobj.namespace->dobj.name,
tyinfo->rolname, tyinfo->typacl);
fmtId(domcheck->dobj.name));
appendPQExpBuffer(labelq, "ON DOMAIN %s",
fmtId(qtypname));
- dumpComment(fout, dopt, labelq->data,
+ dumpComment(fout, labelq->data,
tyinfo->dobj.namespace->dobj.name,
tyinfo->rolname,
domcheck->dobj.catId, 0, tyinfo->dobj.dumpId);
* composite type
*/
static void
-dumpCompositeType(Archive *fout, DumpOptions *dopt, TypeInfo *tyinfo)
+dumpCompositeType(Archive *fout, TypeInfo *tyinfo)
{
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer q = createPQExpBuffer();
PQExpBuffer dropped = createPQExpBuffer();
PQExpBuffer delq = createPQExpBuffer();
/* Dump Type Comments and Security Labels */
- dumpComment(fout, dopt, labelq->data,
+ dumpComment(fout, labelq->data,
tyinfo->dobj.namespace->dobj.name, tyinfo->rolname,
tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId);
- dumpSecLabel(fout, dopt, labelq->data,
+ dumpSecLabel(fout, labelq->data,
tyinfo->dobj.namespace->dobj.name, tyinfo->rolname,
tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId);
- dumpACL(fout, dopt, tyinfo->dobj.catId, tyinfo->dobj.dumpId, "TYPE",
+ dumpACL(fout, tyinfo->dobj.catId, tyinfo->dobj.dumpId, "TYPE",
qtypname, NULL, tyinfo->dobj.name,
tyinfo->dobj.namespace->dobj.name,
tyinfo->rolname, tyinfo->typacl);
* We dump a shell definition in advance of the I/O functions for the type.
*/
static void
-dumpShellType(Archive *fout, DumpOptions *dopt, ShellTypeInfo *stinfo)
+dumpShellType(Archive *fout, ShellTypeInfo *stinfo)
{
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer q;
/* Skip if not to be dumped */
* procedural language
*/
static void
-dumpProcLang(Archive *fout, DumpOptions *dopt, ProcLangInfo *plang)
+dumpProcLang(Archive *fout, ProcLangInfo *plang)
{
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer defqry;
PQExpBuffer delqry;
PQExpBuffer labelq;
NULL, NULL);
/* Dump Proc Lang Comments and Security Labels */
- dumpComment(fout, dopt, labelq->data,
+ dumpComment(fout, labelq->data,
NULL, "",
plang->dobj.catId, 0, plang->dobj.dumpId);
- dumpSecLabel(fout, dopt, labelq->data,
+ dumpSecLabel(fout, labelq->data,
NULL, "",
plang->dobj.catId, 0, plang->dobj.dumpId);
if (plang->lanpltrusted)
- dumpACL(fout, dopt, plang->dobj.catId, plang->dobj.dumpId, "LANGUAGE",
+ dumpACL(fout, plang->dobj.catId, plang->dobj.dumpId, "LANGUAGE",
qlanname, NULL, plang->dobj.name,
lanschema,
plang->lanowner, plang->lanacl);
* dump out one function
*/
static void
-dumpFunc(Archive *fout, DumpOptions *dopt, FuncInfo *finfo)
+dumpFunc(Archive *fout, FuncInfo *finfo)
{
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer query;
PQExpBuffer q;
PQExpBuffer delqry;
NULL, NULL);
/* Dump Function Comments and Security Labels */
- dumpComment(fout, dopt, labelq->data,
+ dumpComment(fout, labelq->data,
finfo->dobj.namespace->dobj.name, finfo->rolname,
finfo->dobj.catId, 0, finfo->dobj.dumpId);
- dumpSecLabel(fout, dopt, labelq->data,
+ dumpSecLabel(fout, labelq->data,
finfo->dobj.namespace->dobj.name, finfo->rolname,
finfo->dobj.catId, 0, finfo->dobj.dumpId);
- dumpACL(fout, dopt, finfo->dobj.catId, finfo->dobj.dumpId, "FUNCTION",
+ dumpACL(fout, finfo->dobj.catId, finfo->dobj.dumpId, "FUNCTION",
funcsig, NULL, funcsig_tag,
finfo->dobj.namespace->dobj.name,
finfo->rolname, finfo->proacl);
* Dump a user-defined cast
*/
static void
-dumpCast(Archive *fout, DumpOptions *dopt, CastInfo *cast)
+dumpCast(Archive *fout, CastInfo *cast)
{
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer defqry;
PQExpBuffer delqry;
PQExpBuffer labelq;
NULL, NULL);
/* Dump Cast Comments */
- dumpComment(fout, dopt, labelq->data,
+ dumpComment(fout, labelq->data,
NULL, "",
cast->dobj.catId, 0, cast->dobj.dumpId);
* Dump a transform
*/
static void
-dumpTransform(Archive *fout, DumpOptions *dopt, TransformInfo *transform)
+dumpTransform(Archive *fout, TransformInfo *transform)
{
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer defqry;
PQExpBuffer delqry;
PQExpBuffer labelq;
NULL, NULL);
/* Dump Transform Comments */
- dumpComment(fout, dopt, labelq->data,
+ dumpComment(fout, labelq->data,
NULL, "",
transform->dobj.catId, 0, transform->dobj.dumpId);
* write out a single operator definition
*/
static void
-dumpOpr(Archive *fout, DumpOptions *dopt, OprInfo *oprinfo)
+dumpOpr(Archive *fout, OprInfo *oprinfo)
{
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer query;
PQExpBuffer q;
PQExpBuffer delq;
NULL, NULL);
/* Dump Operator Comments */
- dumpComment(fout, dopt, labelq->data,
+ dumpComment(fout, labelq->data,
oprinfo->dobj.namespace->dobj.name, oprinfo->rolname,
oprinfo->dobj.catId, 0, oprinfo->dobj.dumpId);
* write out a single operator class definition
*/
static void
-dumpOpclass(Archive *fout, DumpOptions *dopt, OpclassInfo *opcinfo)
+dumpOpclass(Archive *fout, OpclassInfo *opcinfo)
{
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer query;
PQExpBuffer q;
PQExpBuffer delq;
NULL, NULL);
/* Dump Operator Class Comments */
- dumpComment(fout, dopt, labelq->data,
+ dumpComment(fout, labelq->data,
NULL, opcinfo->rolname,
opcinfo->dobj.catId, 0, opcinfo->dobj.dumpId);
* specific opclass within the opfamily.
*/
static void
-dumpOpfamily(Archive *fout, DumpOptions *dopt, OpfamilyInfo *opfinfo)
+dumpOpfamily(Archive *fout, OpfamilyInfo *opfinfo)
{
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer query;
PQExpBuffer q;
PQExpBuffer delq;
NULL, NULL);
/* Dump Operator Family Comments */
- dumpComment(fout, dopt, labelq->data,
+ dumpComment(fout, labelq->data,
NULL, opfinfo->rolname,
opfinfo->dobj.catId, 0, opfinfo->dobj.dumpId);
* write out a single collation definition
*/
static void
-dumpCollation(Archive *fout, DumpOptions *dopt, CollInfo *collinfo)
+dumpCollation(Archive *fout, CollInfo *collinfo)
{
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer query;
PQExpBuffer q;
PQExpBuffer delq;
NULL, NULL);
/* Dump Collation Comments */
- dumpComment(fout, dopt, labelq->data,
+ dumpComment(fout, labelq->data,
collinfo->dobj.namespace->dobj.name, collinfo->rolname,
collinfo->dobj.catId, 0, collinfo->dobj.dumpId);
* write out a single conversion definition
*/
static void
-dumpConversion(Archive *fout, DumpOptions *dopt, ConvInfo *convinfo)
+dumpConversion(Archive *fout, ConvInfo *convinfo)
{
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer query;
PQExpBuffer q;
PQExpBuffer delq;
NULL, NULL);
/* Dump Conversion Comments */
- dumpComment(fout, dopt, labelq->data,
+ dumpComment(fout, labelq->data,
convinfo->dobj.namespace->dobj.name, convinfo->rolname,
convinfo->dobj.catId, 0, convinfo->dobj.dumpId);
* write out a single aggregate definition
*/
static void
-dumpAgg(Archive *fout, DumpOptions *dopt, AggInfo *agginfo)
+dumpAgg(Archive *fout, AggInfo *agginfo)
{
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer query;
PQExpBuffer q;
PQExpBuffer delq;
NULL, NULL);
/* Dump Aggregate Comments */
- dumpComment(fout, dopt, labelq->data,
+ dumpComment(fout, labelq->data,
agginfo->aggfn.dobj.namespace->dobj.name, agginfo->aggfn.rolname,
agginfo->aggfn.dobj.catId, 0, agginfo->aggfn.dobj.dumpId);
- dumpSecLabel(fout, dopt, labelq->data,
+ dumpSecLabel(fout, labelq->data,
agginfo->aggfn.dobj.namespace->dobj.name, agginfo->aggfn.rolname,
agginfo->aggfn.dobj.catId, 0, agginfo->aggfn.dobj.dumpId);
aggsig = format_function_signature(fout, &agginfo->aggfn, true);
aggsig_tag = format_function_signature(fout, &agginfo->aggfn, false);
- dumpACL(fout, dopt, agginfo->aggfn.dobj.catId, agginfo->aggfn.dobj.dumpId,
+ dumpACL(fout, agginfo->aggfn.dobj.catId, agginfo->aggfn.dobj.dumpId,
"FUNCTION",
aggsig, NULL, aggsig_tag,
agginfo->aggfn.dobj.namespace->dobj.name,
* write out a single text search parser
*/
static void
-dumpTSParser(Archive *fout, DumpOptions *dopt, TSParserInfo *prsinfo)
+dumpTSParser(Archive *fout, TSParserInfo *prsinfo)
{
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer q;
PQExpBuffer delq;
PQExpBuffer labelq;
NULL, NULL);
/* Dump Parser Comments */
- dumpComment(fout, dopt, labelq->data,
+ dumpComment(fout, labelq->data,
NULL, "",
prsinfo->dobj.catId, 0, prsinfo->dobj.dumpId);
* write out a single text search dictionary
*/
static void
-dumpTSDictionary(Archive *fout, DumpOptions *dopt, TSDictInfo *dictinfo)
+dumpTSDictionary(Archive *fout, TSDictInfo *dictinfo)
{
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer q;
PQExpBuffer delq;
PQExpBuffer labelq;
NULL, NULL);
/* Dump Dictionary Comments */
- dumpComment(fout, dopt, labelq->data,
+ dumpComment(fout, labelq->data,
NULL, dictinfo->rolname,
dictinfo->dobj.catId, 0, dictinfo->dobj.dumpId);
* write out a single text search template
*/
static void
-dumpTSTemplate(Archive *fout, DumpOptions *dopt, TSTemplateInfo *tmplinfo)
+dumpTSTemplate(Archive *fout, TSTemplateInfo *tmplinfo)
{
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer q;
PQExpBuffer delq;
PQExpBuffer labelq;
NULL, NULL);
/* Dump Template Comments */
- dumpComment(fout, dopt, labelq->data,
+ dumpComment(fout, labelq->data,
NULL, "",
tmplinfo->dobj.catId, 0, tmplinfo->dobj.dumpId);
* write out a single text search configuration
*/
static void
-dumpTSConfig(Archive *fout, DumpOptions *dopt, TSConfigInfo *cfginfo)
+dumpTSConfig(Archive *fout, TSConfigInfo *cfginfo)
{
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer q;
PQExpBuffer delq;
PQExpBuffer labelq;
NULL, NULL);
/* Dump Configuration Comments */
- dumpComment(fout, dopt, labelq->data,
+ dumpComment(fout, labelq->data,
NULL, cfginfo->rolname,
cfginfo->dobj.catId, 0, cfginfo->dobj.dumpId);
* write out a single foreign-data wrapper definition
*/
static void
-dumpForeignDataWrapper(Archive *fout, DumpOptions *dopt, FdwInfo *fdwinfo)
+dumpForeignDataWrapper(Archive *fout, FdwInfo *fdwinfo)
{
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer q;
PQExpBuffer delq;
PQExpBuffer labelq;
NULL, NULL);
/* Handle the ACL */
- dumpACL(fout, dopt, fdwinfo->dobj.catId, fdwinfo->dobj.dumpId,
+ dumpACL(fout, fdwinfo->dobj.catId, fdwinfo->dobj.dumpId,
"FOREIGN DATA WRAPPER",
qfdwname, NULL, fdwinfo->dobj.name,
NULL, fdwinfo->rolname,
fdwinfo->fdwacl);
/* Dump Foreign Data Wrapper Comments */
- dumpComment(fout, dopt, labelq->data,
+ dumpComment(fout, labelq->data,
NULL, fdwinfo->rolname,
fdwinfo->dobj.catId, 0, fdwinfo->dobj.dumpId);
* write out a foreign server definition
*/
static void
-dumpForeignServer(Archive *fout, DumpOptions *dopt, ForeignServerInfo *srvinfo)
+dumpForeignServer(Archive *fout, ForeignServerInfo *srvinfo)
{
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer q;
PQExpBuffer delq;
PQExpBuffer labelq;
NULL, NULL);
/* Handle the ACL */
- dumpACL(fout, dopt, srvinfo->dobj.catId, srvinfo->dobj.dumpId,
+ dumpACL(fout, srvinfo->dobj.catId, srvinfo->dobj.dumpId,
"FOREIGN SERVER",
qsrvname, NULL, srvinfo->dobj.name,
NULL, srvinfo->rolname,
srvinfo->dobj.catId, srvinfo->dobj.dumpId);
/* Dump Foreign Server Comments */
- dumpComment(fout, dopt, labelq->data,
+ dumpComment(fout, labelq->data,
NULL, srvinfo->rolname,
srvinfo->dobj.catId, 0, srvinfo->dobj.dumpId);
* Write out default privileges information
*/
static void
-dumpDefaultACL(Archive *fout, DumpOptions *dopt, DefaultACLInfo *daclinfo)
+dumpDefaultACL(Archive *fout, DefaultACLInfo *daclinfo)
{
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer q;
PQExpBuffer tag;
const char *type;
*----------
*/
static void
-dumpACL(Archive *fout, DumpOptions *dopt, CatalogId objCatId, DumpId objDumpId,
+dumpACL(Archive *fout, CatalogId objCatId, DumpId objDumpId,
const char *type, const char *name, const char *subname,
const char *tag, const char *nspname, const char *owner,
const char *acls)
{
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer sql;
/* Do nothing if ACL dump is not enabled */
* calling ArchiveEntry() for the specified object.
*/
static void
-dumpSecLabel(Archive *fout, DumpOptions *dopt, const char *target,
+dumpSecLabel(Archive *fout, const char *target,
const char *namespace, const char *owner,
CatalogId catalogId, int subid, DumpId dumpId)
{
+ DumpOptions *dopt = fout->dopt;
SecLabelItem *labels;
int nlabels;
int i;
* and its columns.
*/
static void
-dumpTableSecLabel(Archive *fout, DumpOptions *dopt, TableInfo *tbinfo, const char *reltypename)
+dumpTableSecLabel(Archive *fout, TableInfo *tbinfo, const char *reltypename)
{
+ DumpOptions *dopt = fout->dopt;
SecLabelItem *labels;
int nlabels;
int i;
* write out to fout the declarations (not data) of a user-defined table
*/
static void
-dumpTable(Archive *fout, DumpOptions *dopt, TableInfo *tbinfo)
+dumpTable(Archive *fout, TableInfo *tbinfo)
{
+ DumpOptions *dopt = fout->dopt;
+
if (tbinfo->dobj.dump && !dopt->dataOnly)
{
char *namecopy;
if (tbinfo->relkind == RELKIND_SEQUENCE)
- dumpSequence(fout, dopt, tbinfo);
+ dumpSequence(fout, tbinfo);
else
- dumpTableSchema(fout, dopt, tbinfo);
+ dumpTableSchema(fout, tbinfo);
/* Handle the ACL here */
namecopy = pg_strdup(fmtId(tbinfo->dobj.name));
- dumpACL(fout, dopt, tbinfo->dobj.catId, tbinfo->dobj.dumpId,
+ dumpACL(fout, tbinfo->dobj.catId, tbinfo->dobj.dumpId,
(tbinfo->relkind == RELKIND_SEQUENCE) ? "SEQUENCE" :
"TABLE",
namecopy, NULL, tbinfo->dobj.name,
attnamecopy = pg_strdup(fmtId(attname));
acltag = psprintf("%s.%s", tbinfo->dobj.name, attname);
/* Column's GRANT type is always TABLE */
- dumpACL(fout, dopt, tbinfo->dobj.catId, tbinfo->dobj.dumpId, "TABLE",
+ dumpACL(fout, tbinfo->dobj.catId, tbinfo->dobj.dumpId, "TABLE",
namecopy, attnamecopy, acltag,
tbinfo->dobj.namespace->dobj.name, tbinfo->rolname,
attacl);
* write the declaration (not data) of one user-defined table or view
*/
static void
-dumpTableSchema(Archive *fout, DumpOptions *dopt, TableInfo *tbinfo)
+dumpTableSchema(Archive *fout, TableInfo *tbinfo)
{
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer q = createPQExpBuffer();
PQExpBuffer delq = createPQExpBuffer();
PQExpBuffer labelq = createPQExpBuffer();
/* Dump Table Comments */
- dumpTableComment(fout, dopt, tbinfo, reltypename);
+ dumpTableComment(fout, tbinfo, reltypename);
/* Dump Table Security Labels */
- dumpTableSecLabel(fout, dopt, tbinfo, reltypename);
+ dumpTableSecLabel(fout, tbinfo, reltypename);
/* Dump comments on inlined table constraints */
for (j = 0; j < tbinfo->ncheck; j++)
if (constr->separate || !constr->conislocal)
continue;
- dumpTableConstraintComment(fout, dopt, constr);
+ dumpTableConstraintComment(fout, constr);
}
destroyPQExpBuffer(q);
* dumpAttrDef --- dump an attribute's default-value declaration
*/
static void
-dumpAttrDef(Archive *fout, DumpOptions *dopt, AttrDefInfo *adinfo)
+dumpAttrDef(Archive *fout, AttrDefInfo *adinfo)
{
+ DumpOptions *dopt = fout->dopt;
TableInfo *tbinfo = adinfo->adtable;
int adnum = adinfo->adnum;
PQExpBuffer q;
* write out to fout a user-defined index
*/
static void
-dumpIndex(Archive *fout, DumpOptions *dopt, IndxInfo *indxinfo)
+dumpIndex(Archive *fout, IndxInfo *indxinfo)
{
+ DumpOptions *dopt = fout->dopt;
TableInfo *tbinfo = indxinfo->indextable;
bool is_constraint = (indxinfo->indexconstraint != 0);
PQExpBuffer q;
}
/* Dump Index Comments */
- dumpComment(fout, dopt, labelq->data,
+ dumpComment(fout, labelq->data,
tbinfo->dobj.namespace->dobj.name,
tbinfo->rolname,
indxinfo->dobj.catId, 0,
* write out to fout a user-defined constraint
*/
static void
-dumpConstraint(Archive *fout, DumpOptions *dopt, ConstraintInfo *coninfo)
+dumpConstraint(Archive *fout, ConstraintInfo *coninfo)
{
+ DumpOptions *dopt = fout->dopt;
TableInfo *tbinfo = coninfo->contable;
PQExpBuffer q;
PQExpBuffer delq;
/* Dump Constraint Comments --- only works for table constraints */
if (tbinfo && coninfo->separate)
- dumpTableConstraintComment(fout, dopt, coninfo);
+ dumpTableConstraintComment(fout, coninfo);
destroyPQExpBuffer(q);
destroyPQExpBuffer(delq);
* or as a separate ALTER command.
*/
static void
-dumpTableConstraintComment(Archive *fout, DumpOptions *dopt, ConstraintInfo *coninfo)
+dumpTableConstraintComment(Archive *fout, ConstraintInfo *coninfo)
{
TableInfo *tbinfo = coninfo->contable;
PQExpBuffer labelq = createPQExpBuffer();
fmtId(coninfo->dobj.name));
appendPQExpBuffer(labelq, "ON %s",
fmtId(tbinfo->dobj.name));
- dumpComment(fout, dopt, labelq->data,
+ dumpComment(fout, labelq->data,
tbinfo->dobj.namespace->dobj.name,
tbinfo->rolname,
coninfo->dobj.catId, 0,
* write the declaration (not data) of one user-defined sequence
*/
static void
-dumpSequence(Archive *fout, DumpOptions *dopt, TableInfo *tbinfo)
+dumpSequence(Archive *fout, TableInfo *tbinfo)
{
+ DumpOptions *dopt = fout->dopt;
PGresult *res;
char *startv,
*incby,
}
/* Dump Sequence Comments and Security Labels */
- dumpComment(fout, dopt, labelq->data,
+ dumpComment(fout, labelq->data,
tbinfo->dobj.namespace->dobj.name, tbinfo->rolname,
tbinfo->dobj.catId, 0, tbinfo->dobj.dumpId);
- dumpSecLabel(fout, dopt, labelq->data,
+ dumpSecLabel(fout, labelq->data,
tbinfo->dobj.namespace->dobj.name, tbinfo->rolname,
tbinfo->dobj.catId, 0, tbinfo->dobj.dumpId);
* write the declaration of one user-defined table trigger
*/
static void
-dumpTrigger(Archive *fout, DumpOptions *dopt, TriggerInfo *tginfo)
+dumpTrigger(Archive *fout, TriggerInfo *tginfo)
{
+ DumpOptions *dopt = fout->dopt;
TableInfo *tbinfo = tginfo->tgtable;
PQExpBuffer query;
PQExpBuffer delqry;
NULL, 0,
NULL, NULL);
- dumpComment(fout, dopt, labelq->data,
+ dumpComment(fout, labelq->data,
tbinfo->dobj.namespace->dobj.name, tbinfo->rolname,
tginfo->dobj.catId, 0, tginfo->dobj.dumpId);
* write the declaration of one user-defined event trigger
*/
static void
-dumpEventTrigger(Archive *fout, DumpOptions *dopt, EventTriggerInfo *evtinfo)
+dumpEventTrigger(Archive *fout, EventTriggerInfo *evtinfo)
{
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer query;
PQExpBuffer labelq;
"EVENT TRIGGER", SECTION_POST_DATA,
query->data, "", NULL, NULL, 0, NULL, NULL);
- dumpComment(fout, dopt, labelq->data,
+ dumpComment(fout, labelq->data,
NULL, evtinfo->evtowner,
evtinfo->dobj.catId, 0, evtinfo->dobj.dumpId);
* Dump a rule
*/
static void
-dumpRule(Archive *fout, DumpOptions *dopt, RuleInfo *rinfo)
+dumpRule(Archive *fout, RuleInfo *rinfo)
{
+ DumpOptions *dopt = fout->dopt;
TableInfo *tbinfo = rinfo->ruletable;
PQExpBuffer query;
PQExpBuffer cmd;
NULL, NULL);
/* Dump rule comments */
- dumpComment(fout, dopt, labelq->data,
+ dumpComment(fout, labelq->data,
tbinfo->dobj.namespace->dobj.name,
tbinfo->rolname,
rinfo->dobj.catId, 0, rinfo->dobj.dumpId);
* but perhaps we can provide a better solution in the future.
*/
void
-getExtensionMembership(Archive *fout, DumpOptions *dopt, ExtensionInfo extinfo[],
+getExtensionMembership(Archive *fout, ExtensionInfo extinfo[],
int numExtensions)
{
+ DumpOptions *dopt = fout->dopt;
PQExpBuffer query;
PGresult *res;
int ntups,