From 062587ef037bc6cc157a16abc19b5c2e8a9a6ede Mon Sep 17 00:00:00 2001 From: Peter Geoghegan Date: Sat, 3 Sep 2022 22:19:51 -0700 Subject: [PATCH v3 4/6] 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 | 30 +-- 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_db.c | 14 +- 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 | 254 +++++++++++++------------- src/bin/pg_dump/pg_dump.h | 6 +- src/bin/pg_dump/pg_dumpall.c | 6 +- 12 files changed, 192 insertions(+), 191 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..b31ce1c44 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,13 +316,13 @@ 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); extern int archprintf(Archive *AH, const char *fmt,...) pg_attribute_printf(2, 3); -#define appendStringLiteralAH(buf,str,AH) \ +#define appendStringLiteralArchive(buf,str,AH) \ appendStringLiteral(buf, str, (AH)->encoding, (AH)->std_strings) #endif /* PG_BACKUP_H */ 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_db.c b/src/bin/pg_dump/pg_backup_db.c index 28baa68fd..a2cb5cbe8 100644 --- a/src/bin/pg_dump/pg_backup_db.c +++ b/src/bin/pg_dump/pg_backup_db.c @@ -98,7 +98,7 @@ ReconnectToServer(ArchiveHandle *AH, const char *dbname) /* * Make, or remake, a database connection with the given parameters. * - * The resulting connection handle is stored in AHX->connection. + * The resulting connection handle is stored in AH->connection. * * An interactive password prompt is automatically issued if required. * We store the results of that in AHX->savedPassword. @@ -107,11 +107,11 @@ ReconnectToServer(ArchiveHandle *AH, const char *dbname) * username never does change, so one savedPassword is sufficient. */ void -ConnectDatabase(Archive *AHX, +ConnectDatabase(Archive *A, const ConnParams *cparams, bool isReconnect) { - ArchiveHandle *AH = (ArchiveHandle *) AHX; + ArchiveHandle *AH = (ArchiveHandle *) A; trivalue prompt_password; char *password; bool new_pass; @@ -222,9 +222,9 @@ ConnectDatabase(Archive *AHX, * have one running. */ void -DisconnectDatabase(Archive *AHX) +DisconnectDatabase(Archive *A) { - ArchiveHandle *AH = (ArchiveHandle *) AHX; + ArchiveHandle *AH = (ArchiveHandle *) A; char errbuf[1]; if (!AH->connection) @@ -251,9 +251,9 @@ DisconnectDatabase(Archive *AHX) } PGconn * -GetConnection(Archive *AHX) +GetConnection(Archive *A) { - ArchiveHandle *AH = (ArchiveHandle *) AHX; + ArchiveHandle *AH = (ArchiveHandle *) A; return AH->connection; } 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..b5fc060ce 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); } @@ -2320,9 +2320,9 @@ dumpTableData_insert(Archive *fout, const void *dcontext) default: /* All other types are printed as string literals. */ resetPQExpBuffer(q); - appendStringLiteralAH(q, - PQgetvalue(res, tuple, field), - fout); + appendStringLiteralArchive(q, + PQgetvalue(res, tuple, field), + fout); archputs(q->data, fout); break; } @@ -2920,7 +2920,7 @@ dumpDatabase(Archive *fout) if (strlen(encoding) > 0) { appendPQExpBufferStr(creaQry, " ENCODING = "); - appendStringLiteralAH(creaQry, encoding, fout); + appendStringLiteralArchive(creaQry, encoding, fout); } appendPQExpBufferStr(creaQry, " LOCALE_PROVIDER = "); @@ -2935,25 +2935,25 @@ dumpDatabase(Archive *fout) if (strlen(collate) > 0 && strcmp(collate, ctype) == 0) { appendPQExpBufferStr(creaQry, " LOCALE = "); - appendStringLiteralAH(creaQry, collate, fout); + appendStringLiteralArchive(creaQry, collate, fout); } else { if (strlen(collate) > 0) { appendPQExpBufferStr(creaQry, " LC_COLLATE = "); - appendStringLiteralAH(creaQry, collate, fout); + appendStringLiteralArchive(creaQry, collate, fout); } if (strlen(ctype) > 0) { appendPQExpBufferStr(creaQry, " LC_CTYPE = "); - appendStringLiteralAH(creaQry, ctype, fout); + appendStringLiteralArchive(creaQry, ctype, fout); } } if (iculocale) { appendPQExpBufferStr(creaQry, " ICU_LOCALE = "); - appendStringLiteralAH(creaQry, iculocale, fout); + appendStringLiteralArchive(creaQry, iculocale, fout); } /* @@ -2965,9 +2965,9 @@ dumpDatabase(Archive *fout) if (!PQgetisnull(res, 0, i_datcollversion)) { appendPQExpBufferStr(creaQry, " COLLATION_VERSION = "); - appendStringLiteralAH(creaQry, - PQgetvalue(res, 0, i_datcollversion), - fout); + appendStringLiteralArchive(creaQry, + PQgetvalue(res, 0, i_datcollversion), + fout); } } @@ -3021,7 +3021,7 @@ dumpDatabase(Archive *fout) * database. */ appendPQExpBuffer(dbQry, "COMMENT ON DATABASE %s IS ", qdatname); - appendStringLiteralAH(dbQry, comment, fout); + appendStringLiteralArchive(dbQry, comment, fout); appendPQExpBufferStr(dbQry, ";\n"); ArchiveEntry(fout, nilCatalogId, createDumpId(), @@ -3100,7 +3100,7 @@ dumpDatabase(Archive *fout) */ appendPQExpBufferStr(delQry, "UPDATE pg_catalog.pg_database " "SET datistemplate = false WHERE datname = "); - appendStringLiteralAH(delQry, datname, fout); + appendStringLiteralArchive(delQry, datname, fout); appendPQExpBufferStr(delQry, ";\n"); } @@ -3118,7 +3118,7 @@ dumpDatabase(Archive *fout) "SET datfrozenxid = '%u', datminmxid = '%u'\n" "WHERE datname = ", frozenxid, minmxid); - appendStringLiteralAH(creaQry, datname, fout); + appendStringLiteralArchive(creaQry, datname, fout); appendPQExpBufferStr(creaQry, ";\n"); } @@ -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); + appendStringLiteralArchive(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); + appendStringLiteralArchive(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); @@ -4593,7 +4593,7 @@ dumpSubscription(Archive *fout, const SubscriptionInfo *subinfo) appendPQExpBuffer(query, "CREATE SUBSCRIPTION %s CONNECTION ", qsubname); - appendStringLiteralAH(query, subinfo->subconninfo, fout); + appendStringLiteralArchive(query, subinfo->subconninfo, fout); /* Build list of quoted publications and append them to query. */ if (!parsePGArray(subinfo->subpublications, &pubnames, &npubnames)) @@ -4610,7 +4610,7 @@ dumpSubscription(Archive *fout, const SubscriptionInfo *subinfo) appendPQExpBuffer(query, " PUBLICATION %s WITH (connect = false, slot_name = ", publications->data); if (subinfo->subslotname) - appendStringLiteralAH(query, subinfo->subslotname, fout); + appendStringLiteralArchive(query, subinfo->subslotname, fout); else appendPQExpBufferStr(query, "NONE"); @@ -9506,7 +9506,7 @@ dumpCommentExtended(Archive *fout, const char *type, if (namespace && *namespace) appendPQExpBuffer(query, "%s.", fmtId(namespace)); appendPQExpBuffer(query, "%s IS ", name); - appendStringLiteralAH(query, comments->descr, fout); + appendStringLiteralArchive(query, comments->descr, fout); appendPQExpBufferStr(query, ";\n"); appendPQExpBuffer(tag, "%s %s", type, name); @@ -9596,7 +9596,7 @@ dumpTableComment(Archive *fout, const TableInfo *tbinfo, resetPQExpBuffer(query); appendPQExpBuffer(query, "COMMENT ON %s %s IS ", reltypename, fmtQualifiedDumpable(tbinfo)); - appendStringLiteralAH(query, descr, fout); + appendStringLiteralArchive(query, descr, fout); appendPQExpBufferStr(query, ";\n"); ArchiveEntry(fout, nilCatalogId, createDumpId(), @@ -9621,7 +9621,7 @@ dumpTableComment(Archive *fout, const TableInfo *tbinfo, fmtQualifiedDumpable(tbinfo)); appendPQExpBuffer(query, "%s IS ", fmtId(tbinfo->attnames[objsubid - 1])); - appendStringLiteralAH(query, descr, fout); + appendStringLiteralArchive(query, descr, fout); appendPQExpBufferStr(query, ";\n"); ArchiveEntry(fout, nilCatalogId, createDumpId(), @@ -10131,12 +10131,12 @@ dumpExtension(Archive *fout, const ExtensionInfo *extinfo) appendPQExpBufferStr(q, "SELECT pg_catalog.binary_upgrade_create_empty_extension("); - appendStringLiteralAH(q, extinfo->dobj.name, fout); + appendStringLiteralArchive(q, extinfo->dobj.name, fout); appendPQExpBufferStr(q, ", "); - appendStringLiteralAH(q, extinfo->namespace, fout); + appendStringLiteralArchive(q, extinfo->namespace, fout); appendPQExpBufferStr(q, ", "); appendPQExpBuffer(q, "%s, ", extinfo->relocatable ? "true" : "false"); - appendStringLiteralAH(q, extinfo->extversion, fout); + appendStringLiteralArchive(q, extinfo->extversion, fout); appendPQExpBufferStr(q, ", "); /* @@ -10145,12 +10145,12 @@ dumpExtension(Archive *fout, const ExtensionInfo *extinfo) * preserved in binary upgrade. */ if (strlen(extinfo->extconfig) > 2) - appendStringLiteralAH(q, extinfo->extconfig, fout); + appendStringLiteralArchive(q, extinfo->extconfig, fout); else appendPQExpBufferStr(q, "NULL"); appendPQExpBufferStr(q, ", "); if (strlen(extinfo->extcondition) > 2) - appendStringLiteralAH(q, extinfo->extcondition, fout); + appendStringLiteralArchive(q, extinfo->extcondition, fout); else appendPQExpBufferStr(q, "NULL"); appendPQExpBufferStr(q, ", "); @@ -10165,7 +10165,7 @@ dumpExtension(Archive *fout, const ExtensionInfo *extinfo) { if (n++ > 0) appendPQExpBufferChar(q, ','); - appendStringLiteralAH(q, extobj->name, fout); + appendStringLiteralArchive(q, extobj->name, fout); } } appendPQExpBufferStr(q, "]::pg_catalog.text[]"); @@ -10300,7 +10300,7 @@ dumpEnumType(Archive *fout, const TypeInfo *tyinfo) if (i > 0) appendPQExpBufferChar(q, ','); appendPQExpBufferStr(q, "\n "); - appendStringLiteralAH(q, label, fout); + appendStringLiteralArchive(q, label, fout); } } @@ -10323,7 +10323,7 @@ dumpEnumType(Archive *fout, const TypeInfo *tyinfo) "SELECT pg_catalog.binary_upgrade_set_next_pg_enum_oid('%u'::pg_catalog.oid);\n", enum_oid); appendPQExpBuffer(q, "ALTER TYPE %s ADD VALUE ", qualtypname); - appendStringLiteralAH(q, label, fout); + appendStringLiteralArchive(q, label, fout); appendPQExpBufferStr(q, ";\n\n"); } } @@ -10748,7 +10748,7 @@ dumpBaseType(Archive *fout, const TypeInfo *tyinfo) { appendPQExpBufferStr(q, ",\n DEFAULT = "); if (typdefault_is_literal) - appendStringLiteralAH(q, typdefault, fout); + appendStringLiteralArchive(q, typdefault, fout); else appendPQExpBufferStr(q, typdefault); } @@ -10764,7 +10764,7 @@ dumpBaseType(Archive *fout, const TypeInfo *tyinfo) if (strcmp(typcategory, "U") != 0) { appendPQExpBufferStr(q, ",\n CATEGORY = "); - appendStringLiteralAH(q, typcategory, fout); + appendStringLiteralArchive(q, typcategory, fout); } if (strcmp(typispreferred, "t") == 0) @@ -10773,7 +10773,7 @@ dumpBaseType(Archive *fout, const TypeInfo *tyinfo) if (typdelim && strcmp(typdelim, ",") != 0) { appendPQExpBufferStr(q, ",\n DELIMITER = "); - appendStringLiteralAH(q, typdelim, fout); + appendStringLiteralArchive(q, typdelim, fout); } if (*typalign == TYPALIGN_CHAR) @@ -10931,7 +10931,7 @@ dumpDomain(Archive *fout, const TypeInfo *tyinfo) { appendPQExpBufferStr(q, " DEFAULT "); if (typdefault_is_literal) - appendStringLiteralAH(q, typdefault, fout); + appendStringLiteralArchive(q, typdefault, fout); else appendPQExpBufferStr(q, typdefault); } @@ -11151,9 +11151,9 @@ dumpCompositeType(Archive *fout, const TypeInfo *tyinfo) "SET attlen = %s, " "attalign = '%s', attbyval = false\n" "WHERE attname = ", attlen, attalign); - appendStringLiteralAH(dropped, attname, fout); + appendStringLiteralArchive(dropped, attname, fout); appendPQExpBufferStr(dropped, "\n AND attrelid = "); - appendStringLiteralAH(dropped, qualtypname, fout); + appendStringLiteralArchive(dropped, qualtypname, fout); appendPQExpBufferStr(dropped, "::pg_catalog.regclass;\n"); appendPQExpBuffer(dropped, "ALTER TYPE %s ", @@ -11283,7 +11283,7 @@ dumpCompositeTypeColComments(Archive *fout, const TypeInfo *tyinfo, appendPQExpBuffer(query, "COMMENT ON COLUMN %s.", fmtQualifiedDumpable(tyinfo)); appendPQExpBuffer(query, "%s IS ", fmtId(attname)); - appendStringLiteralAH(query, descr, fout); + appendStringLiteralArchive(query, descr, fout); appendPQExpBufferStr(query, ";\n"); ArchiveEntry(fout, nilCatalogId, createDumpId(), @@ -11700,7 +11700,7 @@ dumpFunc(Archive *fout, const FuncInfo *finfo) else if (probin[0] != '\0') { appendPQExpBufferStr(asPart, "AS "); - appendStringLiteralAH(asPart, probin, fout); + appendStringLiteralArchive(asPart, probin, fout); if (prosrc[0] != '\0') { appendPQExpBufferStr(asPart, ", "); @@ -11711,7 +11711,7 @@ dumpFunc(Archive *fout, const FuncInfo *finfo) */ if (dopt->disable_dollar_quoting || (strchr(prosrc, '\'') == NULL && strchr(prosrc, '\\') == NULL)) - appendStringLiteralAH(asPart, prosrc, fout); + appendStringLiteralArchive(asPart, prosrc, fout); else appendStringLiteralDQ(asPart, prosrc, NULL); } @@ -11721,7 +11721,7 @@ dumpFunc(Archive *fout, const FuncInfo *finfo) appendPQExpBufferStr(asPart, "AS "); /* with no bin, dollar quote src unconditionally if allowed */ if (dopt->disable_dollar_quoting) - appendStringLiteralAH(asPart, prosrc, fout); + appendStringLiteralArchive(asPart, prosrc, fout); else appendStringLiteralDQ(asPart, prosrc, NULL); } @@ -11892,13 +11892,13 @@ dumpFunc(Archive *fout, const FuncInfo *finfo) { if (nameptr != namelist) appendPQExpBufferStr(q, ", "); - appendStringLiteralAH(q, *nameptr, fout); + appendStringLiteralArchive(q, *nameptr, fout); } } pg_free(namelist); } else - appendStringLiteralAH(q, pos, fout); + appendStringLiteralArchive(q, pos, fout); } appendPQExpBuffer(q, "\n %s;\n", asPart->data); @@ -13181,7 +13181,7 @@ dumpCollation(Archive *fout, const CollInfo *collinfo) if (colliculocale != NULL) { appendPQExpBufferStr(q, ", locale = "); - appendStringLiteralAH(q, colliculocale, fout); + appendStringLiteralArchive(q, colliculocale, fout); } else { @@ -13191,14 +13191,14 @@ dumpCollation(Archive *fout, const CollInfo *collinfo) if (strcmp(collcollate, collctype) == 0) { appendPQExpBufferStr(q, ", locale = "); - appendStringLiteralAH(q, collcollate, fout); + appendStringLiteralArchive(q, collcollate, fout); } else { appendPQExpBufferStr(q, ", lc_collate = "); - appendStringLiteralAH(q, collcollate, fout); + appendStringLiteralArchive(q, collcollate, fout); appendPQExpBufferStr(q, ", lc_ctype = "); - appendStringLiteralAH(q, collctype, fout); + appendStringLiteralArchive(q, collctype, fout); } } @@ -13214,9 +13214,9 @@ dumpCollation(Archive *fout, const CollInfo *collinfo) if (!PQgetisnull(res, 0, i_collversion)) { appendPQExpBufferStr(q, ", version = "); - appendStringLiteralAH(q, - PQgetvalue(res, 0, i_collversion), - fout); + appendStringLiteralArchive(q, + PQgetvalue(res, 0, i_collversion), + fout); } } @@ -13310,9 +13310,9 @@ dumpConversion(Archive *fout, const ConvInfo *convinfo) appendPQExpBuffer(q, "CREATE %sCONVERSION %s FOR ", (condefault) ? "DEFAULT " : "", fmtQualifiedDumpable(convinfo)); - appendStringLiteralAH(q, conforencoding, fout); + appendStringLiteralArchive(q, conforencoding, fout); appendPQExpBufferStr(q, " TO "); - appendStringLiteralAH(q, contoencoding, fout); + appendStringLiteralArchive(q, contoencoding, fout); /* regproc output is already sufficiently quoted */ appendPQExpBuffer(q, " FROM %s;\n", conproc); @@ -13567,7 +13567,7 @@ dumpAgg(Archive *fout, const AggInfo *agginfo) if (!PQgetisnull(res, 0, i_agginitval)) { appendPQExpBufferStr(details, ",\n INITCOND = "); - appendStringLiteralAH(details, agginitval, fout); + appendStringLiteralArchive(details, agginitval, fout); } if (strcmp(aggfinalfn, "-") != 0) @@ -13623,7 +13623,7 @@ dumpAgg(Archive *fout, const AggInfo *agginfo) if (!PQgetisnull(res, 0, i_aggminitval)) { appendPQExpBufferStr(details, ",\n MINITCOND = "); - appendStringLiteralAH(details, aggminitval, fout); + appendStringLiteralArchive(details, aggminitval, fout); } if (strcmp(aggmfinalfn, "-") != 0) @@ -14168,12 +14168,12 @@ dumpForeignServer(Archive *fout, const ForeignServerInfo *srvinfo) if (srvinfo->srvtype && strlen(srvinfo->srvtype) > 0) { appendPQExpBufferStr(q, " TYPE "); - appendStringLiteralAH(q, srvinfo->srvtype, fout); + appendStringLiteralArchive(q, srvinfo->srvtype, fout); } if (srvinfo->srvversion && strlen(srvinfo->srvversion) > 0) { appendPQExpBufferStr(q, " VERSION "); - appendStringLiteralAH(q, srvinfo->srvversion, fout); + appendStringLiteralArchive(q, srvinfo->srvversion, fout); } appendPQExpBufferStr(q, " FOREIGN DATA WRAPPER "); @@ -14589,7 +14589,7 @@ dumpSecLabel(Archive *fout, const char *type, const char *name, if (namespace && *namespace) appendPQExpBuffer(query, "%s.", fmtId(namespace)); appendPQExpBuffer(query, "%s IS ", name); - appendStringLiteralAH(query, labels[i].label, fout); + appendStringLiteralArchive(query, labels[i].label, fout); appendPQExpBufferStr(query, ";\n"); } @@ -14672,7 +14672,7 @@ dumpTableSecLabel(Archive *fout, const TableInfo *tbinfo, const char *reltypenam } appendPQExpBuffer(query, "SECURITY LABEL FOR %s ON %s IS ", fmtId(provider), target->data); - appendStringLiteralAH(query, label, fout); + appendStringLiteralArchive(query, label, fout); appendPQExpBufferStr(query, ";\n"); } if (query->len > 0) @@ -15488,11 +15488,11 @@ dumpTableSchema(Archive *fout, const TableInfo *tbinfo) appendPQExpBufferStr(q, "\n-- set missing value.\n"); appendPQExpBufferStr(q, "SELECT pg_catalog.binary_upgrade_set_missing_value("); - appendStringLiteralAH(q, qualrelname, fout); + appendStringLiteralArchive(q, qualrelname, fout); appendPQExpBufferStr(q, "::pg_catalog.regclass,"); - appendStringLiteralAH(q, tbinfo->attnames[j], fout); + appendStringLiteralArchive(q, tbinfo->attnames[j], fout); appendPQExpBufferChar(q, ','); - appendStringLiteralAH(q, tbinfo->attmissingval[j], fout); + appendStringLiteralArchive(q, tbinfo->attmissingval[j], fout); appendPQExpBufferStr(q, ");\n\n"); } } @@ -15535,9 +15535,9 @@ dumpTableSchema(Archive *fout, const TableInfo *tbinfo) "WHERE attname = ", tbinfo->attlen[j], tbinfo->attalign[j]); - appendStringLiteralAH(q, tbinfo->attnames[j], fout); + appendStringLiteralArchive(q, tbinfo->attnames[j], fout); appendPQExpBufferStr(q, "\n AND attrelid = "); - appendStringLiteralAH(q, qualrelname, fout); + appendStringLiteralArchive(q, qualrelname, fout); appendPQExpBufferStr(q, "::pg_catalog.regclass;\n"); if (tbinfo->relkind == RELKIND_RELATION || @@ -15556,9 +15556,9 @@ dumpTableSchema(Archive *fout, const TableInfo *tbinfo) appendPQExpBufferStr(q, "UPDATE pg_catalog.pg_attribute\n" "SET attislocal = false\n" "WHERE attname = "); - appendStringLiteralAH(q, tbinfo->attnames[j], fout); + appendStringLiteralArchive(q, tbinfo->attnames[j], fout); appendPQExpBufferStr(q, "\n AND attrelid = "); - appendStringLiteralAH(q, qualrelname, fout); + appendStringLiteralArchive(q, qualrelname, fout); appendPQExpBufferStr(q, "::pg_catalog.regclass;\n"); } } @@ -15584,9 +15584,9 @@ dumpTableSchema(Archive *fout, const TableInfo *tbinfo) appendPQExpBufferStr(q, "UPDATE pg_catalog.pg_constraint\n" "SET conislocal = false\n" "WHERE contype = 'c' AND conname = "); - appendStringLiteralAH(q, constr->dobj.name, fout); + appendStringLiteralArchive(q, constr->dobj.name, fout); appendPQExpBufferStr(q, "\n AND conrelid = "); - appendStringLiteralAH(q, qualrelname, fout); + appendStringLiteralArchive(q, qualrelname, fout); appendPQExpBufferStr(q, "::pg_catalog.regclass;\n"); } @@ -15629,7 +15629,7 @@ dumpTableSchema(Archive *fout, const TableInfo *tbinfo) "SET relfrozenxid = '%u', relminmxid = '%u'\n" "WHERE oid = ", tbinfo->frozenxid, tbinfo->minmxid); - appendStringLiteralAH(q, qualrelname, fout); + appendStringLiteralArchive(q, qualrelname, fout); appendPQExpBufferStr(q, "::pg_catalog.regclass;\n"); if (tbinfo->toast_oid) @@ -15661,7 +15661,7 @@ dumpTableSchema(Archive *fout, const TableInfo *tbinfo) appendPQExpBufferStr(q, "UPDATE pg_catalog.pg_class\n" "SET relispopulated = 't'\n" "WHERE oid = "); - appendStringLiteralAH(q, qualrelname, fout); + appendStringLiteralArchive(q, qualrelname, fout); appendPQExpBufferStr(q, "::pg_catalog.regclass;\n"); } @@ -16910,7 +16910,7 @@ dumpSequenceData(Archive *fout, const TableDataInfo *tdinfo) resetPQExpBuffer(query); appendPQExpBufferStr(query, "SELECT pg_catalog.setval("); - appendStringLiteralAH(query, fmtQualifiedDumpable(tbinfo), fout); + appendStringLiteralArchive(query, fmtQualifiedDumpable(tbinfo), fout); appendPQExpBuffer(query, ", %s, %s);\n", last, (called ? "true" : "false")); @@ -17072,7 +17072,7 @@ dumpTrigger(Archive *fout, const TriggerInfo *tginfo) if (findx > 0) appendPQExpBufferStr(query, ", "); - appendStringLiteralAH(query, p, fout); + appendStringLiteralArchive(query, p, fout); p += tlen + 1; } free(tgargs); 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