v2-0002-Harmonize-parameter-names-in-pg_dump-pg_dumpall.patch
application/octet-stream
Filename: v2-0002-Harmonize-parameter-names-in-pg_dump-pg_dumpall.patch
Type: application/octet-stream
Part: 0
Patch
Format: format-patch
Series: patch v2-0002
Subject: Harmonize parameter names in pg_dump/pg_dumpall
| File | + | − |
|---|---|---|
| src/bin/pg_dump/common.c | 1 | 1 |
| src/bin/pg_dump/parallel.c | 2 | 2 |
| src/bin/pg_dump/pg_backup_archiver.c | 26 | 27 |
| src/bin/pg_dump/pg_backup_archiver.h | 3 | 3 |
| src/bin/pg_dump/pg_backup_custom.c | 1 | 1 |
| src/bin/pg_dump/pg_backup_directory.c | 1 | 1 |
| src/bin/pg_dump/pg_backup.h | 14 | 14 |
| src/bin/pg_dump/pg_backup_tar.c | 2 | 2 |
| src/bin/pg_dump/pg_dumpall.c | 4 | 2 |
| src/bin/pg_dump/pg_dump.c | 60 | 60 |
| src/bin/pg_dump/pg_dump.h | 3 | 3 |
From af31e6e22e04f1308ff1fb3b94bfdecb82211c6a Mon Sep 17 00:00:00 2001
From: Peter Geoghegan <pg@bowt.ie>
Date: Sat, 3 Sep 2022 22:19:51 -0700
Subject: [PATCH v2 2/3] Harmonize parameter names in pg_dump/pg_dumpall
---
src/bin/pg_dump/common.c | 2 +-
src/bin/pg_dump/parallel.c | 4 +-
src/bin/pg_dump/pg_backup.h | 28 +++---
src/bin/pg_dump/pg_backup_archiver.c | 53 ++++++------
src/bin/pg_dump/pg_backup_archiver.h | 6 +-
src/bin/pg_dump/pg_backup_custom.c | 2 +-
src/bin/pg_dump/pg_backup_directory.c | 2 +-
src/bin/pg_dump/pg_backup_tar.c | 4 +-
src/bin/pg_dump/pg_dump.c | 120 +++++++++++++-------------
src/bin/pg_dump/pg_dump.h | 6 +-
src/bin/pg_dump/pg_dumpall.c | 6 +-
11 files changed, 117 insertions(+), 116 deletions(-)
diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c
index 395f817fa..44fa52cc5 100644
--- a/src/bin/pg_dump/common.c
+++ b/src/bin/pg_dump/common.c
@@ -79,7 +79,7 @@ typedef struct _catalogIdMapEntry
static catalogid_hash *catalogIdHash = NULL;
-static void flagInhTables(Archive *fout, TableInfo *tbinfo, int numTables,
+static void flagInhTables(Archive *fout, TableInfo *tblinfo, int numTables,
InhInfo *inhinfo, int numInherits);
static void flagInhIndexes(Archive *fout, TableInfo *tblinfo, int numTables);
static void flagInhAttrs(DumpOptions *dopt, TableInfo *tblinfo, int numTables);
diff --git a/src/bin/pg_dump/parallel.c b/src/bin/pg_dump/parallel.c
index c8a70d9bc..1c194ceb4 100644
--- a/src/bin/pg_dump/parallel.c
+++ b/src/bin/pg_dump/parallel.c
@@ -325,9 +325,9 @@ getThreadLocalPQExpBuffer(void)
* as soon as they've created the ArchiveHandle.
*/
void
-on_exit_close_archive(Archive *AHX)
+on_exit_close_archive(Archive *A)
{
- shutdown_info.AHX = AHX;
+ shutdown_info.AHX = A;
on_exit_nicely(archive_close_connection, &shutdown_info);
}
diff --git a/src/bin/pg_dump/pg_backup.h b/src/bin/pg_dump/pg_backup.h
index fcc5f6bd0..e234ec216 100644
--- a/src/bin/pg_dump/pg_backup.h
+++ b/src/bin/pg_dump/pg_backup.h
@@ -270,33 +270,33 @@ typedef int DumpId;
* Function pointer prototypes for assorted callback methods.
*/
-typedef int (*DataDumperPtr) (Archive *AH, const void *userArg);
+typedef int (*DataDumperPtr) (Archive *A, const void *userArg);
-typedef void (*SetupWorkerPtrType) (Archive *AH);
+typedef void (*SetupWorkerPtrType) (Archive *A);
/*
* Main archiver interface.
*/
-extern void ConnectDatabase(Archive *AHX,
+extern void ConnectDatabase(Archive *A,
const ConnParams *cparams,
bool isReconnect);
-extern void DisconnectDatabase(Archive *AHX);
-extern PGconn *GetConnection(Archive *AHX);
+extern void DisconnectDatabase(Archive *A);
+extern PGconn *GetConnection(Archive *A);
/* Called to write *data* to the archive */
-extern void WriteData(Archive *AH, const void *data, size_t dLen);
+extern void WriteData(Archive *A, const void *data, size_t dLen);
-extern int StartBlob(Archive *AH, Oid oid);
-extern int EndBlob(Archive *AH, Oid oid);
+extern int StartBlob(Archive *A, Oid oid);
+extern int EndBlob(Archive *A, Oid oid);
-extern void CloseArchive(Archive *AH);
+extern void CloseArchive(Archive *A);
-extern void SetArchiveOptions(Archive *AH, DumpOptions *dopt, RestoreOptions *ropt);
+extern void SetArchiveOptions(Archive *A, DumpOptions *dopt, RestoreOptions *ropt);
-extern void ProcessArchiveRestoreOptions(Archive *AH);
+extern void ProcessArchiveRestoreOptions(Archive *A);
-extern void RestoreArchive(Archive *AH);
+extern void RestoreArchive(Archive *A);
/* Open an existing archive */
extern Archive *OpenArchive(const char *FileSpec, const ArchiveFormat fmt);
@@ -307,7 +307,7 @@ extern Archive *CreateArchive(const char *FileSpec, const ArchiveFormat fmt,
SetupWorkerPtrType setupDumpWorker);
/* The --list option */
-extern void PrintTOCSummary(Archive *AH);
+extern void PrintTOCSummary(Archive *A);
extern RestoreOptions *NewRestoreOptions(void);
@@ -316,7 +316,7 @@ extern void InitDumpOptions(DumpOptions *opts);
extern DumpOptions *dumpOptionsFromRestoreOptions(RestoreOptions *ropt);
/* Rearrange and filter TOC entries */
-extern void SortTocFromFile(Archive *AHX);
+extern void SortTocFromFile(Archive *A);
/* Convenience functions used only when writing DATA */
extern void archputs(const char *s, Archive *AH);
diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c
index 233198afc..0f3f90bf2 100644
--- a/src/bin/pg_dump/pg_backup_archiver.c
+++ b/src/bin/pg_dump/pg_backup_archiver.c
@@ -261,10 +261,10 @@ OpenArchive(const char *FileSpec, const ArchiveFormat fmt)
/* Public */
void
-CloseArchive(Archive *AHX)
+CloseArchive(Archive *A)
{
int res = 0;
- ArchiveHandle *AH = (ArchiveHandle *) AHX;
+ ArchiveHandle *AH = (ArchiveHandle *) A;
AH->ClosePtr(AH);
@@ -281,22 +281,22 @@ CloseArchive(Archive *AHX)
/* Public */
void
-SetArchiveOptions(Archive *AH, DumpOptions *dopt, RestoreOptions *ropt)
+SetArchiveOptions(Archive *A, DumpOptions *dopt, RestoreOptions *ropt)
{
/* 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;
+ A->dopt = dopt;
+ A->ropt = ropt;
}
/* Public */
void
-ProcessArchiveRestoreOptions(Archive *AHX)
+ProcessArchiveRestoreOptions(Archive *A)
{
- ArchiveHandle *AH = (ArchiveHandle *) AHX;
+ ArchiveHandle *AH = (ArchiveHandle *) A;
RestoreOptions *ropt = AH->public.ropt;
TocEntry *te;
teSection curSection;
@@ -349,9 +349,9 @@ ProcessArchiveRestoreOptions(Archive *AHX)
/* Public */
void
-RestoreArchive(Archive *AHX)
+RestoreArchive(Archive *A)
{
- ArchiveHandle *AH = (ArchiveHandle *) AHX;
+ ArchiveHandle *AH = (ArchiveHandle *) A;
RestoreOptions *ropt = AH->public.ropt;
bool parallel_mode;
TocEntry *te;
@@ -415,10 +415,10 @@ RestoreArchive(Archive *AHX)
* restore; allow the attempt regardless of the version of the restore
* target.
*/
- AHX->minRemoteVersion = 0;
- AHX->maxRemoteVersion = 9999999;
+ A->minRemoteVersion = 0;
+ A->maxRemoteVersion = 9999999;
- ConnectDatabase(AHX, &ropt->cparams, false);
+ ConnectDatabase(A, &ropt->cparams, false);
/*
* If we're talking to the DB directly, don't send comments since they
@@ -479,7 +479,7 @@ RestoreArchive(Archive *AHX)
if (ropt->single_txn)
{
if (AH->connection)
- StartTransaction(AHX);
+ StartTransaction(A);
else
ahprintf(AH, "BEGIN;\n\n");
}
@@ -724,7 +724,7 @@ RestoreArchive(Archive *AHX)
if (ropt->single_txn)
{
if (AH->connection)
- CommitTransaction(AHX);
+ CommitTransaction(A);
else
ahprintf(AH, "COMMIT;\n\n");
}
@@ -1031,9 +1031,9 @@ _enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te)
/* Public */
void
-WriteData(Archive *AHX, const void *data, size_t dLen)
+WriteData(Archive *A, const void *data, size_t dLen)
{
- ArchiveHandle *AH = (ArchiveHandle *) AHX;
+ ArchiveHandle *AH = (ArchiveHandle *) A;
if (!AH->currToc)
pg_fatal("internal error -- WriteData cannot be called outside the context of a DataDumper routine");
@@ -1052,10 +1052,9 @@ WriteData(Archive *AHX, const void *data, size_t dLen)
/* Public */
TocEntry *
-ArchiveEntry(Archive *AHX, CatalogId catalogId, DumpId dumpId,
- ArchiveOpts *opts)
+ArchiveEntry(Archive *A, CatalogId catalogId, DumpId dumpId, ArchiveOpts *opts)
{
- ArchiveHandle *AH = (ArchiveHandle *) AHX;
+ ArchiveHandle *AH = (ArchiveHandle *) A;
TocEntry *newToc;
newToc = (TocEntry *) pg_malloc0(sizeof(TocEntry));
@@ -1110,9 +1109,9 @@ ArchiveEntry(Archive *AHX, CatalogId catalogId, DumpId dumpId,
/* Public */
void
-PrintTOCSummary(Archive *AHX)
+PrintTOCSummary(Archive *A)
{
- ArchiveHandle *AH = (ArchiveHandle *) AHX;
+ ArchiveHandle *AH = (ArchiveHandle *) A;
RestoreOptions *ropt = AH->public.ropt;
TocEntry *te;
teSection curSection;
@@ -1214,9 +1213,9 @@ PrintTOCSummary(Archive *AHX)
/* Called by a dumper to signal start of a BLOB */
int
-StartBlob(Archive *AHX, Oid oid)
+StartBlob(Archive *A, Oid oid)
{
- ArchiveHandle *AH = (ArchiveHandle *) AHX;
+ ArchiveHandle *AH = (ArchiveHandle *) A;
if (!AH->StartBlobPtr)
pg_fatal("large-object output not supported in chosen format");
@@ -1228,9 +1227,9 @@ StartBlob(Archive *AHX, Oid oid)
/* Called by a dumper to signal end of a BLOB */
int
-EndBlob(Archive *AHX, Oid oid)
+EndBlob(Archive *A, Oid oid)
{
- ArchiveHandle *AH = (ArchiveHandle *) AHX;
+ ArchiveHandle *AH = (ArchiveHandle *) A;
if (AH->EndBlobPtr)
AH->EndBlobPtr(AH, AH->currToc, oid);
@@ -1358,9 +1357,9 @@ EndRestoreBlob(ArchiveHandle *AH, Oid oid)
***********/
void
-SortTocFromFile(Archive *AHX)
+SortTocFromFile(Archive *A)
{
- ArchiveHandle *AH = (ArchiveHandle *) AHX;
+ ArchiveHandle *AH = (ArchiveHandle *) A;
RestoreOptions *ropt = AH->public.ropt;
FILE *fh;
StringInfoData linebuf;
diff --git a/src/bin/pg_dump/pg_backup_archiver.h b/src/bin/pg_dump/pg_backup_archiver.h
index 084cd87e8..12b84e2e6 100644
--- a/src/bin/pg_dump/pg_backup_archiver.h
+++ b/src/bin/pg_dump/pg_backup_archiver.h
@@ -404,7 +404,7 @@ struct _tocEntry
};
extern int parallel_restore(ArchiveHandle *AH, TocEntry *te);
-extern void on_exit_close_archive(Archive *AHX);
+extern void on_exit_close_archive(Archive *A);
extern void warn_or_exit_horribly(ArchiveHandle *AH, const char *fmt,...) pg_attribute_printf(2, 3);
@@ -428,7 +428,7 @@ typedef struct _archiveOpts
} ArchiveOpts;
#define ARCHIVE_OPTS(...) &(ArchiveOpts){__VA_ARGS__}
/* Called to add a TOC entry */
-extern TocEntry *ArchiveEntry(Archive *AHX, CatalogId catalogId,
+extern TocEntry *ArchiveEntry(Archive *A, CatalogId catalogId,
DumpId dumpId, ArchiveOpts *opts);
extern void WriteHead(ArchiveHandle *AH);
@@ -457,7 +457,7 @@ extern bool checkSeek(FILE *fp);
extern size_t WriteInt(ArchiveHandle *AH, int i);
extern int ReadInt(ArchiveHandle *AH);
extern char *ReadStr(ArchiveHandle *AH);
-extern size_t WriteStr(ArchiveHandle *AH, const char *s);
+extern size_t WriteStr(ArchiveHandle *AH, const char *c);
int ReadOffset(ArchiveHandle *, pgoff_t *);
size_t WriteOffset(ArchiveHandle *, pgoff_t, int);
diff --git a/src/bin/pg_dump/pg_backup_custom.c b/src/bin/pg_dump/pg_backup_custom.c
index 1023fea01..a0a55a1ed 100644
--- a/src/bin/pg_dump/pg_backup_custom.c
+++ b/src/bin/pg_dump/pg_backup_custom.c
@@ -40,7 +40,7 @@ static void _StartData(ArchiveHandle *AH, TocEntry *te);
static void _WriteData(ArchiveHandle *AH, const void *data, size_t dLen);
static void _EndData(ArchiveHandle *AH, TocEntry *te);
static int _WriteByte(ArchiveHandle *AH, const int i);
-static int _ReadByte(ArchiveHandle *);
+static int _ReadByte(ArchiveHandle *AH);
static void _WriteBuf(ArchiveHandle *AH, const void *buf, size_t len);
static void _ReadBuf(ArchiveHandle *AH, void *buf, size_t len);
static void _CloseArchive(ArchiveHandle *AH);
diff --git a/src/bin/pg_dump/pg_backup_directory.c b/src/bin/pg_dump/pg_backup_directory.c
index 3f46f7988..798182b6f 100644
--- a/src/bin/pg_dump/pg_backup_directory.c
+++ b/src/bin/pg_dump/pg_backup_directory.c
@@ -67,7 +67,7 @@ static void _StartData(ArchiveHandle *AH, TocEntry *te);
static void _EndData(ArchiveHandle *AH, TocEntry *te);
static void _WriteData(ArchiveHandle *AH, const void *data, size_t dLen);
static int _WriteByte(ArchiveHandle *AH, const int i);
-static int _ReadByte(ArchiveHandle *);
+static int _ReadByte(ArchiveHandle *AH);
static void _WriteBuf(ArchiveHandle *AH, const void *buf, size_t len);
static void _ReadBuf(ArchiveHandle *AH, void *buf, size_t len);
static void _CloseArchive(ArchiveHandle *AH);
diff --git a/src/bin/pg_dump/pg_backup_tar.c b/src/bin/pg_dump/pg_backup_tar.c
index 7960b81c0..402b93c61 100644
--- a/src/bin/pg_dump/pg_backup_tar.c
+++ b/src/bin/pg_dump/pg_backup_tar.c
@@ -46,7 +46,7 @@ static void _StartData(ArchiveHandle *AH, TocEntry *te);
static void _WriteData(ArchiveHandle *AH, const void *data, size_t dLen);
static void _EndData(ArchiveHandle *AH, TocEntry *te);
static int _WriteByte(ArchiveHandle *AH, const int i);
-static int _ReadByte(ArchiveHandle *);
+static int _ReadByte(ArchiveHandle *AH);
static void _WriteBuf(ArchiveHandle *AH, const void *buf, size_t len);
static void _ReadBuf(ArchiveHandle *AH, void *buf, size_t len);
static void _CloseArchive(ArchiveHandle *AH);
@@ -97,7 +97,7 @@ typedef struct
static void _LoadBlobs(ArchiveHandle *AH);
static TAR_MEMBER *tarOpen(ArchiveHandle *AH, const char *filename, char mode);
-static void tarClose(ArchiveHandle *AH, TAR_MEMBER *TH);
+static void tarClose(ArchiveHandle *AH, TAR_MEMBER *th);
#ifdef __NOT_USED__
static char *tarGets(char *buf, size_t len, TAR_MEMBER *th);
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 67b6d9079..dbed4ebc4 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -159,7 +159,7 @@ static int nseclabels = 0;
(obj)->dobj.name)
static void help(const char *progname);
-static void setup_connection(Archive *AH,
+static void setup_connection(Archive *A,
const char *dumpencoding, const char *dumpsnapshot,
char *use_role);
static ArchiveFormat parseArchiveFormat(const char *format, ArchiveMode *mode);
@@ -221,7 +221,7 @@ static void dumpFunc(Archive *fout, const FuncInfo *finfo);
static void dumpCast(Archive *fout, const CastInfo *cast);
static void dumpTransform(Archive *fout, const TransformInfo *transform);
static void dumpOpr(Archive *fout, const OprInfo *oprinfo);
-static void dumpAccessMethod(Archive *fout, const AccessMethodInfo *oprinfo);
+static void dumpAccessMethod(Archive *fout, const AccessMethodInfo *aminfo);
static void dumpOpclass(Archive *fout, const OpclassInfo *opcinfo);
static void dumpOpfamily(Archive *fout, const OpfamilyInfo *opfinfo);
static void dumpCollation(Archive *fout, const CollInfo *collinfo);
@@ -232,7 +232,7 @@ static void dumpTrigger(Archive *fout, const TriggerInfo *tginfo);
static void dumpEventTrigger(Archive *fout, const EventTriggerInfo *evtinfo);
static void dumpTable(Archive *fout, const TableInfo *tbinfo);
static void dumpTableSchema(Archive *fout, const TableInfo *tbinfo);
-static void dumpTableAttach(Archive *fout, const TableAttachInfo *tbinfo);
+static void dumpTableAttach(Archive *fout, const TableAttachInfo *attachinfo);
static void dumpAttrDef(Archive *fout, const AttrDefInfo *adinfo);
static void dumpSequence(Archive *fout, const TableInfo *tbinfo);
static void dumpSequenceData(Archive *fout, const TableDataInfo *tdinfo);
@@ -287,12 +287,12 @@ static void dumpPolicy(Archive *fout, const PolicyInfo *polinfo);
static void dumpPublication(Archive *fout, const PublicationInfo *pubinfo);
static void dumpPublicationTable(Archive *fout, const PublicationRelInfo *pubrinfo);
static void dumpSubscription(Archive *fout, const SubscriptionInfo *subinfo);
-static void dumpDatabase(Archive *AH);
+static void dumpDatabase(Archive *fout);
static void dumpDatabaseConfig(Archive *AH, PQExpBuffer outbuf,
const char *dbname, Oid dboid);
-static void dumpEncoding(Archive *AH);
-static void dumpStdStrings(Archive *AH);
-static void dumpSearchPath(Archive *AH);
+static void dumpEncoding(Archive *A);
+static void dumpStdStrings(Archive *A);
+static void dumpSearchPath(Archive *A);
static void binary_upgrade_set_type_oids_by_type_oid(Archive *fout,
PQExpBuffer upgrade_buffer,
Oid pg_type_oid,
@@ -315,7 +315,7 @@ static bool nonemptyReloptions(const char *reloptions);
static void appendReloptionsArrayAH(PQExpBuffer buffer, const char *reloptions,
const char *prefix, Archive *fout);
static char *get_synchronized_snapshot(Archive *fout);
-static void setupDumpWorker(Archive *AHX);
+static void setupDumpWorker(Archive *A);
static TableInfo *getRootTableInfo(const TableInfo *tbinfo);
@@ -1069,14 +1069,14 @@ help(const char *progname)
}
static void
-setup_connection(Archive *AH, const char *dumpencoding,
+setup_connection(Archive *A, const char *dumpencoding,
const char *dumpsnapshot, char *use_role)
{
- DumpOptions *dopt = AH->dopt;
- PGconn *conn = GetConnection(AH);
+ DumpOptions *dopt = A->dopt;
+ PGconn *conn = GetConnection(A);
const char *std_strings;
- PQclear(ExecuteSqlQueryForSingleRow(AH, ALWAYS_SECURE_SEARCH_PATH_SQL));
+ PQclear(ExecuteSqlQueryForSingleRow(A, ALWAYS_SECURE_SEARCH_PATH_SQL));
/*
* Set the client encoding if requested.
@@ -1092,18 +1092,18 @@ setup_connection(Archive *AH, const char *dumpencoding,
* Get the active encoding and the standard_conforming_strings setting, so
* we know how to escape strings.
*/
- AH->encoding = PQclientEncoding(conn);
+ A->encoding = PQclientEncoding(conn);
std_strings = PQparameterStatus(conn, "standard_conforming_strings");
- AH->std_strings = (std_strings && strcmp(std_strings, "on") == 0);
+ A->std_strings = (std_strings && strcmp(std_strings, "on") == 0);
/*
* Set the role if requested. In a parallel dump worker, we'll be passed
* use_role == NULL, but AH->use_role is already set (if user specified it
* originally) and we should use that.
*/
- if (!use_role && AH->use_role)
- use_role = AH->use_role;
+ if (!use_role && A->use_role)
+ use_role = A->use_role;
/* Set the role if requested */
if (use_role)
@@ -1111,19 +1111,19 @@ setup_connection(Archive *AH, const char *dumpencoding,
PQExpBuffer query = createPQExpBuffer();
appendPQExpBuffer(query, "SET ROLE %s", fmtId(use_role));
- ExecuteSqlStatement(AH, query->data);
+ ExecuteSqlStatement(A, query->data);
destroyPQExpBuffer(query);
/* save it for possible later use by parallel workers */
- if (!AH->use_role)
- AH->use_role = pg_strdup(use_role);
+ if (!A->use_role)
+ A->use_role = pg_strdup(use_role);
}
/* Set the datestyle to ISO to ensure the dump's portability */
- ExecuteSqlStatement(AH, "SET DATESTYLE = ISO");
+ ExecuteSqlStatement(A, "SET DATESTYLE = ISO");
/* Likewise, avoid using sql_standard intervalstyle */
- ExecuteSqlStatement(AH, "SET INTERVALSTYLE = POSTGRES");
+ ExecuteSqlStatement(A, "SET INTERVALSTYLE = POSTGRES");
/*
* Use an explicitly specified extra_float_digits if it has been provided.
@@ -1136,54 +1136,54 @@ setup_connection(Archive *AH, const char *dumpencoding,
appendPQExpBuffer(q, "SET extra_float_digits TO %d",
extra_float_digits);
- ExecuteSqlStatement(AH, q->data);
+ ExecuteSqlStatement(A, q->data);
destroyPQExpBuffer(q);
}
else
- ExecuteSqlStatement(AH, "SET extra_float_digits TO 3");
+ ExecuteSqlStatement(A, "SET extra_float_digits TO 3");
/*
* Disable synchronized scanning, to prevent unpredictable changes in row
* ordering across a dump and reload.
*/
- ExecuteSqlStatement(AH, "SET synchronize_seqscans TO off");
+ ExecuteSqlStatement(A, "SET synchronize_seqscans TO off");
/*
* Disable timeouts if supported.
*/
- ExecuteSqlStatement(AH, "SET statement_timeout = 0");
- if (AH->remoteVersion >= 90300)
- ExecuteSqlStatement(AH, "SET lock_timeout = 0");
- if (AH->remoteVersion >= 90600)
- ExecuteSqlStatement(AH, "SET idle_in_transaction_session_timeout = 0");
+ ExecuteSqlStatement(A, "SET statement_timeout = 0");
+ if (A->remoteVersion >= 90300)
+ ExecuteSqlStatement(A, "SET lock_timeout = 0");
+ if (A->remoteVersion >= 90600)
+ ExecuteSqlStatement(A, "SET idle_in_transaction_session_timeout = 0");
/*
* Quote all identifiers, if requested.
*/
if (quote_all_identifiers)
- ExecuteSqlStatement(AH, "SET quote_all_identifiers = true");
+ ExecuteSqlStatement(A, "SET quote_all_identifiers = true");
/*
* Adjust row-security mode, if supported.
*/
- if (AH->remoteVersion >= 90500)
+ if (A->remoteVersion >= 90500)
{
if (dopt->enable_row_security)
- ExecuteSqlStatement(AH, "SET row_security = on");
+ ExecuteSqlStatement(A, "SET row_security = on");
else
- ExecuteSqlStatement(AH, "SET row_security = off");
+ ExecuteSqlStatement(A, "SET row_security = off");
}
/*
* Initialize prepared-query state to "nothing prepared". We do this here
* so that a parallel dump worker will have its own state.
*/
- AH->is_prepared = (bool *) pg_malloc0(NUM_PREP_QUERIES * sizeof(bool));
+ A->is_prepared = (bool *) pg_malloc0(NUM_PREP_QUERIES * sizeof(bool));
/*
* Start transaction-snapshot mode transaction to dump consistent data.
*/
- ExecuteSqlStatement(AH, "BEGIN");
+ ExecuteSqlStatement(A, "BEGIN");
/*
* To support the combination of serializable_deferrable with the jobs
@@ -1193,12 +1193,12 @@ setup_connection(Archive *AH, const char *dumpencoding,
* REPEATABLE READ transaction provides the appropriate integrity
* guarantees. This is a kluge, but safe for back-patching.
*/
- if (dopt->serializable_deferrable && AH->sync_snapshot_id == NULL)
- ExecuteSqlStatement(AH,
+ if (dopt->serializable_deferrable && A->sync_snapshot_id == NULL)
+ ExecuteSqlStatement(A,
"SET TRANSACTION ISOLATION LEVEL "
"SERIALIZABLE, READ ONLY, DEFERRABLE");
else
- ExecuteSqlStatement(AH,
+ ExecuteSqlStatement(A,
"SET TRANSACTION ISOLATION LEVEL "
"REPEATABLE READ, READ ONLY");
@@ -1208,28 +1208,28 @@ setup_connection(Archive *AH, const char *dumpencoding,
* is already set (if the server can handle it) and we should use that.
*/
if (dumpsnapshot)
- AH->sync_snapshot_id = pg_strdup(dumpsnapshot);
+ A->sync_snapshot_id = pg_strdup(dumpsnapshot);
- if (AH->sync_snapshot_id)
+ if (A->sync_snapshot_id)
{
PQExpBuffer query = createPQExpBuffer();
appendPQExpBufferStr(query, "SET TRANSACTION SNAPSHOT ");
- appendStringLiteralConn(query, AH->sync_snapshot_id, conn);
- ExecuteSqlStatement(AH, query->data);
+ appendStringLiteralConn(query, A->sync_snapshot_id, conn);
+ ExecuteSqlStatement(A, query->data);
destroyPQExpBuffer(query);
}
- else if (AH->numWorkers > 1)
+ else if (A->numWorkers > 1)
{
- if (AH->isStandby && AH->remoteVersion < 100000)
+ if (A->isStandby && A->remoteVersion < 100000)
pg_fatal("parallel dumps from standby servers are not supported by this server version");
- AH->sync_snapshot_id = get_synchronized_snapshot(AH);
+ A->sync_snapshot_id = get_synchronized_snapshot(A);
}
}
/* Set up connection for a parallel worker process */
static void
-setupDumpWorker(Archive *AH)
+setupDumpWorker(Archive *A)
{
/*
* We want to re-select all the same values the leader connection is
@@ -1237,8 +1237,8 @@ setupDumpWorker(Archive *AH)
* AH->sync_snapshot_id and AH->use_role, but we need to translate the
* inherited encoding value back to a string to pass to setup_connection.
*/
- setup_connection(AH,
- pg_encoding_to_char(AH->encoding),
+ setup_connection(A,
+ pg_encoding_to_char(A->encoding),
NULL,
NULL);
}
@@ -3270,18 +3270,18 @@ dumpDatabaseConfig(Archive *AH, PQExpBuffer outbuf,
* dumpEncoding: put the correct encoding into the archive
*/
static void
-dumpEncoding(Archive *AH)
+dumpEncoding(Archive *A)
{
- const char *encname = pg_encoding_to_char(AH->encoding);
+ const char *encname = pg_encoding_to_char(A->encoding);
PQExpBuffer qry = createPQExpBuffer();
pg_log_info("saving encoding = %s", encname);
appendPQExpBufferStr(qry, "SET client_encoding = ");
- appendStringLiteralAH(qry, encname, AH);
+ appendStringLiteralAH(qry, encname, A);
appendPQExpBufferStr(qry, ";\n");
- ArchiveEntry(AH, nilCatalogId, createDumpId(),
+ ArchiveEntry(A, nilCatalogId, createDumpId(),
ARCHIVE_OPTS(.tag = "ENCODING",
.description = "ENCODING",
.section = SECTION_PRE_DATA,
@@ -3295,9 +3295,9 @@ dumpEncoding(Archive *AH)
* dumpStdStrings: put the correct escape string behavior into the archive
*/
static void
-dumpStdStrings(Archive *AH)
+dumpStdStrings(Archive *A)
{
- const char *stdstrings = AH->std_strings ? "on" : "off";
+ const char *stdstrings = A->std_strings ? "on" : "off";
PQExpBuffer qry = createPQExpBuffer();
pg_log_info("saving standard_conforming_strings = %s",
@@ -3306,7 +3306,7 @@ dumpStdStrings(Archive *AH)
appendPQExpBuffer(qry, "SET standard_conforming_strings = '%s';\n",
stdstrings);
- ArchiveEntry(AH, nilCatalogId, createDumpId(),
+ ArchiveEntry(A, nilCatalogId, createDumpId(),
ARCHIVE_OPTS(.tag = "STDSTRINGS",
.description = "STDSTRINGS",
.section = SECTION_PRE_DATA,
@@ -3319,7 +3319,7 @@ dumpStdStrings(Archive *AH)
* dumpSearchPath: record the active search_path in the archive
*/
static void
-dumpSearchPath(Archive *AH)
+dumpSearchPath(Archive *A)
{
PQExpBuffer qry = createPQExpBuffer();
PQExpBuffer path = createPQExpBuffer();
@@ -3335,7 +3335,7 @@ dumpSearchPath(Archive *AH)
* listing schemas that may appear in search_path but not actually exist,
* which seems like a prudent exclusion.
*/
- res = ExecuteSqlQueryForSingleRow(AH,
+ res = ExecuteSqlQueryForSingleRow(A,
"SELECT pg_catalog.current_schemas(false)");
if (!parsePGArray(PQgetvalue(res, 0, 0), &schemanames, &nschemanames))
@@ -3355,19 +3355,19 @@ dumpSearchPath(Archive *AH)
}
appendPQExpBufferStr(qry, "SELECT pg_catalog.set_config('search_path', ");
- appendStringLiteralAH(qry, path->data, AH);
+ appendStringLiteralAH(qry, path->data, A);
appendPQExpBufferStr(qry, ", false);\n");
pg_log_info("saving search_path = %s", path->data);
- ArchiveEntry(AH, nilCatalogId, createDumpId(),
+ ArchiveEntry(A, nilCatalogId, createDumpId(),
ARCHIVE_OPTS(.tag = "SEARCHPATH",
.description = "SEARCHPATH",
.section = SECTION_PRE_DATA,
.createStmt = qry->data));
/* Also save it in AH->searchpath, in case we're doing plain text dump */
- AH->searchpath = pg_strdup(qry->data);
+ A->searchpath = pg_strdup(qry->data);
free(schemanames);
PQclear(res);
diff --git a/src/bin/pg_dump/pg_dump.h b/src/bin/pg_dump/pg_dump.h
index 69ee939d4..427f5d45f 100644
--- a/src/bin/pg_dump/pg_dump.h
+++ b/src/bin/pg_dump/pg_dump.h
@@ -705,8 +705,8 @@ extern NamespaceInfo *getNamespaces(Archive *fout, int *numNamespaces);
extern ExtensionInfo *getExtensions(Archive *fout, int *numExtensions);
extern TypeInfo *getTypes(Archive *fout, int *numTypes);
extern FuncInfo *getFuncs(Archive *fout, int *numFuncs);
-extern AggInfo *getAggregates(Archive *fout, int *numAggregates);
-extern OprInfo *getOperators(Archive *fout, int *numOperators);
+extern AggInfo *getAggregates(Archive *fout, int *numAggs);
+extern OprInfo *getOperators(Archive *fout, int *numOprs);
extern AccessMethodInfo *getAccessMethods(Archive *fout, int *numAccessMethods);
extern OpclassInfo *getOpclasses(Archive *fout, int *numOpclasses);
extern OpfamilyInfo *getOpfamilies(Archive *fout, int *numOpfamilies);
@@ -723,7 +723,7 @@ extern void getTriggers(Archive *fout, TableInfo tblinfo[], int numTables);
extern ProcLangInfo *getProcLangs(Archive *fout, int *numProcLangs);
extern CastInfo *getCasts(Archive *fout, int *numCasts);
extern TransformInfo *getTransforms(Archive *fout, int *numTransforms);
-extern void getTableAttrs(Archive *fout, TableInfo *tbinfo, int numTables);
+extern void getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables);
extern bool shouldPrintColumn(const DumpOptions *dopt, const TableInfo *tbinfo, int colno);
extern TSParserInfo *getTSParsers(Archive *fout, int *numTSParsers);
extern TSDictInfo *getTSDictionaries(Archive *fout, int *numTSDicts);
diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c
index 69ae027bd..083012ca3 100644
--- a/src/bin/pg_dump/pg_dumpall.c
+++ b/src/bin/pg_dump/pg_dumpall.c
@@ -72,8 +72,10 @@ static void buildShSecLabels(PGconn *conn,
const char *catalog_name, Oid objectId,
const char *objtype, const char *objname,
PQExpBuffer buffer);
-static PGconn *connectDatabase(const char *dbname, const char *connstr, const char *pghost, const char *pgport,
- const char *pguser, trivalue prompt_password, bool fail_on_error);
+static PGconn *connectDatabase(const char *dbname,
+ const char *connection_string, const char *pghost,
+ const char *pgport, const char *pguser,
+ trivalue prompt_password, bool fail_on_error);
static char *constructConnStr(const char **keywords, const char **values);
static PGresult *executeQuery(PGconn *conn, const char *query);
static void executeCommand(PGconn *conn, const char *query);
--
2.34.1