diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2016-01-13 17:48:33 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2016-01-13 17:48:33 -0500 |
commit | 5b5fea2a11741e651f7c25e981dd29b610a08426 (patch) | |
tree | a1c894f26ca809c8e9a6b10a9c974d641a0b2c40 /src/bin/pg_dump/common.c | |
parent | 26905e009babe6020fddcf3820e57e2f87c5539c (diff) |
Access pg_dump's options structs through Archive struct, not directly.
Rather than passing around DumpOptions and RestoreOptions as separate
arguments, add fields to struct Archive to carry pointers to these objects,
and access them through those fields when needed. There already was a
RestoreOptions pointer in Archive, though for no obvious reason it was part
of the "private" struct rather than out where pg_dump.c could see it.
Doing this allows reversion of quite a lot of parameter-addition changes
made in commit 0eea8047bf, which is a good thing IMO because this will
reduce the code delta between 9.4 and 9.5, probably easing a few future
back-patch efforts. Moreover, the previous commit only added a DumpOptions
argument to functions that had to have it at the time, which means we could
anticipate still more code churn (and more back-patch hazard) as the
requirement spread further. I'd hit exactly that problem in my upcoming
patch to fix extension membership marking, which is what motivated me to
do this.
Diffstat (limited to 'src/bin/pg_dump/common.c')
-rw-r--r-- | src/bin/pg_dump/common.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 7869ee90a8f..3b4e478ad94 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -81,7 +81,7 @@ static int strInArray(const char *pattern, char **arr, int arr_size); * Collect information about all potentially dumpable objects */ TableInfo * -getSchemaData(Archive *fout, DumpOptions *dopt, int *numTablesPtr) +getSchemaData(Archive *fout, int *numTablesPtr) { ExtensionInfo *extinfo; InhInfo *inhinfo; @@ -118,7 +118,7 @@ getSchemaData(Archive *fout, DumpOptions *dopt, int *numTablesPtr) */ if (g_verbose) write_msg(NULL, "reading user-defined tables\n"); - tblinfo = getTables(fout, dopt, &numTables); + tblinfo = getTables(fout, &numTables); tblinfoindex = buildIndexArray(tblinfo, numTables, sizeof(TableInfo)); /* Do this after we've built tblinfoindex */ @@ -126,11 +126,11 @@ getSchemaData(Archive *fout, DumpOptions *dopt, int *numTablesPtr) if (g_verbose) write_msg(NULL, "reading extensions\n"); - extinfo = getExtensions(fout, dopt, &numExtensions); + extinfo = getExtensions(fout, &numExtensions); if (g_verbose) write_msg(NULL, "reading user-defined functions\n"); - funinfo = getFuncs(fout, dopt, &numFuncs); + funinfo = getFuncs(fout, &numFuncs); funinfoindex = buildIndexArray(funinfo, numFuncs, sizeof(FuncInfo)); /* this must be after getTables and getFuncs */ @@ -146,7 +146,7 @@ getSchemaData(Archive *fout, DumpOptions *dopt, int *numTablesPtr) if (g_verbose) write_msg(NULL, "reading user-defined aggregate functions\n"); - getAggregates(fout, dopt, &numAggregates); + getAggregates(fout, &numAggregates); if (g_verbose) write_msg(NULL, "reading user-defined operators\n"); @@ -187,7 +187,7 @@ getSchemaData(Archive *fout, DumpOptions *dopt, int *numTablesPtr) if (g_verbose) write_msg(NULL, "reading default privileges\n"); - getDefaultACLs(fout, dopt, &numDefaultACLs); + getDefaultACLs(fout, &numDefaultACLs); if (g_verbose) write_msg(NULL, "reading user-defined collations\n"); @@ -200,7 +200,7 @@ getSchemaData(Archive *fout, DumpOptions *dopt, int *numTablesPtr) if (g_verbose) write_msg(NULL, "reading type casts\n"); - getCasts(fout, dopt, &numCasts); + getCasts(fout, &numCasts); if (g_verbose) write_msg(NULL, "reading transforms\n"); @@ -221,7 +221,7 @@ getSchemaData(Archive *fout, DumpOptions *dopt, int *numTablesPtr) */ if (g_verbose) write_msg(NULL, "finding extension members\n"); - getExtensionMembership(fout, dopt, extinfo, numExtensions); + getExtensionMembership(fout, extinfo, numExtensions); /* Link tables to parents, mark parents of target tables interesting */ if (g_verbose) @@ -230,11 +230,11 @@ getSchemaData(Archive *fout, DumpOptions *dopt, int *numTablesPtr) if (g_verbose) write_msg(NULL, "reading column info for interesting tables\n"); - getTableAttrs(fout, dopt, tblinfo, numTables); + getTableAttrs(fout, tblinfo, numTables); if (g_verbose) write_msg(NULL, "flagging inherited columns in subtables\n"); - flagInhAttrs(dopt, tblinfo, numTables); + flagInhAttrs(fout->dopt, tblinfo, numTables); if (g_verbose) write_msg(NULL, "reading indexes\n"); |