summaryrefslogtreecommitdiff
path: root/src/bin/pg_dump
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/pg_dump')
-rw-r--r--src/bin/pg_dump/common.c4
-rw-r--r--src/bin/pg_dump/dumputils.c28
-rw-r--r--src/bin/pg_dump/dumputils.h15
-rw-r--r--src/bin/pg_dump/pg_backup.h2
-rw-r--r--src/bin/pg_dump/pg_backup_archiver.c47
-rw-r--r--src/bin/pg_dump/pg_backup_archiver.h2
-rw-r--r--src/bin/pg_dump/pg_backup_custom.c8
-rw-r--r--src/bin/pg_dump/pg_backup_db.c14
-rw-r--r--src/bin/pg_dump/pg_backup_directory.c14
-rw-r--r--src/bin/pg_dump/pg_backup_tar.c12
-rw-r--r--src/bin/pg_dump/pg_dump.c96
-rw-r--r--src/bin/pg_dump/pg_dump_sort.c28
-rw-r--r--src/bin/pg_dump/pg_dumpall.c6
13 files changed, 143 insertions, 133 deletions
diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c
index 42d3645a6d..b02217e81d 100644
--- a/src/bin/pg_dump/common.c
+++ b/src/bin/pg_dump/common.c
@@ -597,8 +597,8 @@ buildIndexArray(void *objArray, int numObjs, Size objSize)
static int
DOCatalogIdCompare(const void *p1, const void *p2)
{
- const DumpableObject *obj1 = *(DumpableObject * const *) p1;
- const DumpableObject *obj2 = *(DumpableObject * const *) p2;
+ const DumpableObject *obj1 = *(DumpableObject *const *) p1;
+ const DumpableObject *obj2 = *(DumpableObject *const *) p2;
int cmpval;
/*
diff --git a/src/bin/pg_dump/dumputils.c b/src/bin/pg_dump/dumputils.c
index f5d7b5d859..8574380b9c 100644
--- a/src/bin/pg_dump/dumputils.c
+++ b/src/bin/pg_dump/dumputils.c
@@ -33,11 +33,11 @@ const char *progname = NULL;
static struct
{
- on_exit_nicely_callback function;
+ on_exit_nicely_callback function;
void *arg;
-} on_exit_nicely_list[MAX_ON_EXIT_NICELY];
+} on_exit_nicely_list[MAX_ON_EXIT_NICELY];
-static int on_exit_nicely_index;
+static int on_exit_nicely_index;
#define supports_grant_options(version) ((version) >= 70400)
@@ -1221,9 +1221,9 @@ emitShSecLabels(PGconn *conn, PGresult *res, PQExpBuffer buffer,
int i;
for (i = 0; i < PQntuples(res); i++)
- {
- char *provider = PQgetvalue(res, i, 0);
- char *label = PQgetvalue(res, i, 1);
+ {
+ char *provider = PQgetvalue(res, i, 0);
+ char *label = PQgetvalue(res, i, 1);
/* must use fmtId result before calling it again */
appendPQExpBuffer(buffer,
@@ -1233,7 +1233,7 @@ emitShSecLabels(PGconn *conn, PGresult *res, PQExpBuffer buffer,
" %s IS ",
fmtId(objname));
appendStringLiteralConn(buffer, label, conn);
- appendPQExpBuffer(buffer, ";\n");
+ appendPQExpBuffer(buffer, ";\n");
}
}
@@ -1252,11 +1252,11 @@ set_dump_section(const char *arg, int *dumpSections)
if (*dumpSections == DUMP_UNSECTIONED)
*dumpSections = 0;
- if (strcmp(arg,"pre-data") == 0)
+ if (strcmp(arg, "pre-data") == 0)
*dumpSections |= DUMP_PRE_DATA;
- else if (strcmp(arg,"data") == 0)
+ else if (strcmp(arg, "data") == 0)
*dumpSections |= DUMP_DATA;
- else if (strcmp(arg,"post-data") == 0)
+ else if (strcmp(arg, "post-data") == 0)
*dumpSections |= DUMP_POST_DATA;
else
{
@@ -1304,7 +1304,7 @@ vwrite_msg(const char *modulename, const char *fmt, va_list ap)
/*
- * Fail and die, with a message to stderr. Parameters as for write_msg.
+ * Fail and die, with a message to stderr. Parameters as for write_msg.
*/
void
exit_horribly(const char *modulename, const char *fmt,...)
@@ -1336,11 +1336,11 @@ on_exit_nicely(on_exit_nicely_callback function, void *arg)
void
exit_nicely(int code)
{
- int i;
+ int i;
for (i = on_exit_nicely_index - 1; i >= 0; i--)
- (*on_exit_nicely_list[i].function)(code,
- on_exit_nicely_list[i].arg);
+ (*on_exit_nicely_list[i].function) (code,
+ on_exit_nicely_list[i].arg);
#ifdef WIN32
if (parallel_init_done && GetCurrentThreadId() != mainThreadId)
diff --git a/src/bin/pg_dump/dumputils.h b/src/bin/pg_dump/dumputils.h
index 3d1ed9570a..4ef8cb3a49 100644
--- a/src/bin/pg_dump/dumputils.h
+++ b/src/bin/pg_dump/dumputils.h
@@ -63,12 +63,15 @@ extern void buildShSecLabelQuery(PGconn *conn, const char *catalog_name,
extern void emitShSecLabels(PGconn *conn, PGresult *res,
PQExpBuffer buffer, const char *target, const char *objname);
extern void set_dump_section(const char *arg, int *dumpSections);
-extern void write_msg(const char *modulename, const char *fmt,...)
- __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3)));
-extern void vwrite_msg(const char *modulename, const char *fmt, va_list ap)
- __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 0)));
-extern void exit_horribly(const char *modulename, const char *fmt,...)
- __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3), noreturn));
+extern void
+write_msg(const char *modulename, const char *fmt,...)
+__attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3)));
+extern void
+vwrite_msg(const char *modulename, const char *fmt, va_list ap)
+__attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 0)));
+extern void
+exit_horribly(const char *modulename, const char *fmt,...)
+__attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3), noreturn));
extern void on_exit_nicely(on_exit_nicely_callback function, void *arg);
extern void exit_nicely(int code) __attribute__((noreturn));
diff --git a/src/bin/pg_dump/pg_backup.h b/src/bin/pg_dump/pg_backup.h
index bf7cc1c1ac..3b49395ecb 100644
--- a/src/bin/pg_dump/pg_backup.h
+++ b/src/bin/pg_dump/pg_backup.h
@@ -110,7 +110,7 @@ typedef struct _restoreOptions
const char *filename;
int dataOnly;
int schemaOnly;
- int dumpSections;
+ int dumpSections;
int verbose;
int aclsSkip;
int tocSummary;
diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c
index c049becf12..5826bace68 100644
--- a/src/bin/pg_dump/pg_backup_archiver.c
+++ b/src/bin/pg_dump/pg_backup_archiver.c
@@ -95,7 +95,7 @@ typedef struct _parallel_slot
typedef struct ShutdownInformation
{
ParallelState *pstate;
- Archive *AHX;
+ Archive *AHX;
} ShutdownInformation;
static ShutdownInformation shutdown_info;
@@ -529,8 +529,8 @@ restore_toc_entry(ArchiveHandle *AH, TocEntry *te,
/*
* Ignore DATABASE entry unless we should create it. We must check this
- * here, not in _tocEntryRequired, because the createDB option should
- * not affect emitting a DATABASE entry to an archive file.
+ * here, not in _tocEntryRequired, because the createDB option should not
+ * affect emitting a DATABASE entry to an archive file.
*/
if (!ropt->createDB && strcmp(te->desc, "DATABASE") == 0)
reqs = 0;
@@ -1296,7 +1296,7 @@ RestoreOutput(ArchiveHandle *AH, OutputContext savedContext)
if (res != 0)
exit_horribly(modulename, "could not close output file: %s\n",
- strerror(errno));
+ strerror(errno));
AH->gzOut = savedContext.gzOut;
AH->OF = savedContext.OF;
@@ -1317,8 +1317,8 @@ ahprintf(ArchiveHandle *AH, const char *fmt,...)
/*
* This is paranoid: deal with the possibility that vsnprintf is willing
- * to ignore trailing null or returns > 0 even if string does not fit.
- * It may be the case that it returns cnt = bufsize.
+ * to ignore trailing null or returns > 0 even if string does not fit. It
+ * may be the case that it returns cnt = bufsize.
*/
while (cnt < 0 || cnt >= (bSize - 1))
{
@@ -1456,7 +1456,7 @@ ahwrite(const void *ptr, size_t size, size_t nmemb, ArchiveHandle *AH)
res = fwrite(ptr, size, nmemb, AH->OF);
if (res != nmemb)
exit_horribly(modulename, "could not write to output file: %s\n",
- strerror(errno));
+ strerror(errno));
return res;
}
}
@@ -1465,7 +1465,7 @@ ahwrite(const void *ptr, size_t size, size_t nmemb, ArchiveHandle *AH)
/* on some error, we may decide to go on... */
void
warn_or_exit_horribly(ArchiveHandle *AH,
- const char *modulename, const char *fmt,...)
+ const char *modulename, const char *fmt,...)
{
va_list ap;
@@ -1549,7 +1549,7 @@ _moveBefore(ArchiveHandle *AH, TocEntry *pos, TocEntry *te)
* items.
*
* The arrays are indexed by dump ID (so entry zero is unused). Note that the
- * array entries run only up to maxDumpId. We might see dependency dump IDs
+ * array entries run only up to maxDumpId. We might see dependency dump IDs
* beyond that (if the dump was partial); so always check the array bound
* before trying to touch an array entry.
*/
@@ -1573,7 +1573,7 @@ buildTocEntryArrays(ArchiveHandle *AH)
/*
* tableDataId provides the TABLE DATA item's dump ID for each TABLE
- * TOC entry that has a DATA item. We compute this by reversing the
+ * TOC entry that has a DATA item. We compute this by reversing the
* TABLE DATA item's dependency, knowing that a TABLE DATA item has
* just one dependency and it is the TABLE item.
*/
@@ -1925,8 +1925,8 @@ _discoverArchiveFormat(ArchiveHandle *AH)
else
{
/*
- * *Maybe* we have a tar archive format file or a text dump ...
- * So, read first 512 byte header...
+ * *Maybe* we have a tar archive format file or a text dump ... So,
+ * read first 512 byte header...
*/
cnt = fread(&AH->lookahead[AH->lookaheadLen], 1, 512 - AH->lookaheadLen, fh);
AH->lookaheadLen += cnt;
@@ -1935,7 +1935,10 @@ _discoverArchiveFormat(ArchiveHandle *AH)
(strncmp(AH->lookahead, TEXT_DUMP_HEADER, strlen(TEXT_DUMP_HEADER)) == 0 ||
strncmp(AH->lookahead, TEXT_DUMPALL_HEADER, strlen(TEXT_DUMPALL_HEADER)) == 0))
{
- /* looks like it's probably a text format dump. so suggest they try psql */
+ /*
+ * looks like it's probably a text format dump. so suggest they
+ * try psql
+ */
exit_horribly(modulename, "input file appears to be a text format dump. Please use psql.\n");
}
@@ -2217,7 +2220,7 @@ ReadToc(ArchiveHandle *AH)
/* Sanity check */
if (te->dumpId <= 0)
exit_horribly(modulename,
- "entry ID %d out of range -- perhaps a corrupt TOC\n",
+ "entry ID %d out of range -- perhaps a corrupt TOC\n",
te->dumpId);
te->hadDumper = ReadInt(AH);
@@ -2835,8 +2838,8 @@ _selectTablespace(ArchiveHandle *AH, const char *tablespace)
if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
warn_or_exit_horribly(AH, modulename,
- "could not set default_tablespace to %s: %s",
- fmtId(want), PQerrorMessage(AH->connection));
+ "could not set default_tablespace to %s: %s",
+ fmtId(want), PQerrorMessage(AH->connection));
PQclear(res);
}
@@ -3043,7 +3046,7 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt, bool isDat
if (te->tablespace && !ropt->noTablespace)
{
- char *sanitized_tablespace;
+ char *sanitized_tablespace;
sanitized_tablespace = replace_line_endings(te->tablespace);
ahprintf(AH, "; Tablespace: %s", sanitized_tablespace);
@@ -3150,8 +3153,8 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt, bool isDat
static char *
replace_line_endings(const char *str)
{
- char *result;
- char *s;
+ char *result;
+ char *s;
result = pg_strdup(str);
@@ -3381,7 +3384,7 @@ unsetProcessIdentifier(ParallelStateEntry *pse)
static ParallelStateEntry *
GetMyPSEntry(ParallelState *pstate)
{
- int i;
+ int i;
for (i = 0; i < pstate->numWorkers; i++)
#ifdef WIN32
@@ -3509,8 +3512,8 @@ restore_toc_entries_parallel(ArchiveHandle *AH)
DisconnectDatabase(&AH->public);
/*
- * Set the pstate in the shutdown_info. The exit handler uses pstate if set
- * and falls back to AHX otherwise.
+ * Set the pstate in the shutdown_info. The exit handler uses pstate if
+ * set and falls back to AHX otherwise.
*/
shutdown_info.pstate = pstate;
diff --git a/src/bin/pg_dump/pg_backup_archiver.h b/src/bin/pg_dump/pg_backup_archiver.h
index 4361805baa..8859bd9776 100644
--- a/src/bin/pg_dump/pg_backup_archiver.h
+++ b/src/bin/pg_dump/pg_backup_archiver.h
@@ -256,7 +256,7 @@ typedef struct _archiveHandle
DumpId maxDumpId; /* largest DumpId among all TOC entries */
/* arrays created after the TOC list is complete: */
- struct _tocEntry **tocsByDumpId; /* TOCs indexed by dumpId */
+ struct _tocEntry **tocsByDumpId; /* TOCs indexed by dumpId */
DumpId *tableDataId; /* TABLE DATA ids, indexed by table dumpId */
struct _tocEntry *currToc; /* Used when dumping data */
diff --git a/src/bin/pg_dump/pg_backup_custom.c b/src/bin/pg_dump/pg_backup_custom.c
index 2156d0f619..204309d6ad 100644
--- a/src/bin/pg_dump/pg_backup_custom.c
+++ b/src/bin/pg_dump/pg_backup_custom.c
@@ -466,7 +466,7 @@ _PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt)
else if (!ctx->hasSeek)
exit_horribly(modulename, "could not find block ID %d in archive -- "
"possibly due to out-of-order restore request, "
- "which cannot be handled due to non-seekable input file\n",
+ "which cannot be handled due to non-seekable input file\n",
te->dumpId);
else /* huh, the dataPos led us to EOF? */
exit_horribly(modulename, "could not find block ID %d in archive -- "
@@ -572,10 +572,10 @@ _skipData(ArchiveHandle *AH)
{
if (feof(AH->FH))
exit_horribly(modulename,
- "could not read from input file: end of file\n");
+ "could not read from input file: end of file\n");
else
exit_horribly(modulename,
- "could not read from input file: %s\n", strerror(errno));
+ "could not read from input file: %s\n", strerror(errno));
}
ctx->filePos += blkLen;
@@ -646,7 +646,7 @@ _WriteBuf(ArchiveHandle *AH, const void *buf, size_t len)
if (res != len)
exit_horribly(modulename,
- "could not write to output file: %s\n", strerror(errno));
+ "could not write to output file: %s\n", strerror(errno));
ctx->filePos += res;
return res;
diff --git a/src/bin/pg_dump/pg_backup_db.c b/src/bin/pg_dump/pg_backup_db.c
index b315e68192..d912aaf77f 100644
--- a/src/bin/pg_dump/pg_backup_db.c
+++ b/src/bin/pg_dump/pg_backup_db.c
@@ -182,7 +182,7 @@ _connectDB(ArchiveHandle *AH, const char *reqdb, const char *requser)
{
if (!PQconnectionNeedsPassword(newConn))
exit_horribly(modulename, "could not reconnect to database: %s",
- PQerrorMessage(newConn));
+ PQerrorMessage(newConn));
PQfinish(newConn);
if (password)
@@ -300,7 +300,7 @@ ConnectDatabase(Archive *AHX,
/* check to see that the backend connection was successfully made */
if (PQstatus(AH->connection) == CONNECTION_BAD)
exit_horribly(modulename, "connection to database \"%s\" failed: %s",
- PQdb(AH->connection), PQerrorMessage(AH->connection));
+ PQdb(AH->connection), PQerrorMessage(AH->connection));
/* check for version mismatch */
_check_database_version(AH);
@@ -313,7 +313,7 @@ DisconnectDatabase(Archive *AHX)
{
ArchiveHandle *AH = (ArchiveHandle *) AHX;
- PQfinish(AH->connection); /* noop if AH->connection is NULL */
+ PQfinish(AH->connection); /* noop if AH->connection is NULL */
AH->connection = NULL;
}
@@ -343,7 +343,7 @@ die_on_query_failure(ArchiveHandle *AH, const char *modulename, const char *quer
void
ExecuteSqlStatement(Archive *AHX, const char *query)
{
- ArchiveHandle *AH = (ArchiveHandle *) AHX;
+ ArchiveHandle *AH = (ArchiveHandle *) AHX;
PGresult *res;
res = PQexec(AH->connection, query);
@@ -355,7 +355,7 @@ ExecuteSqlStatement(Archive *AHX, const char *query)
PGresult *
ExecuteSqlQuery(Archive *AHX, const char *query, ExecStatusType status)
{
- ArchiveHandle *AH = (ArchiveHandle *) AHX;
+ ArchiveHandle *AH = (ArchiveHandle *) AHX;
PGresult *res;
res = PQexec(AH->connection, query);
@@ -436,7 +436,7 @@ ExecuteInsertCommands(ArchiveHandle *AH, const char *buf, size_t bufLen)
for (; qry < eos; qry++)
{
- char ch = *qry;
+ char ch = *qry;
/* For neatness, we skip any newlines between commands */
if (!(ch == '\n' && AH->sqlparse.curCmd->len == 0))
@@ -526,7 +526,7 @@ ExecuteSqlCommandBuf(ArchiveHandle *AH, const char *buf, size_t bufLen)
ExecuteSqlCommand(AH, buf, "could not execute query");
else
{
- char *str = (char *) pg_malloc(bufLen + 1);
+ char *str = (char *) pg_malloc(bufLen + 1);
memcpy(str, buf, bufLen);
str[bufLen] = '\0';
diff --git a/src/bin/pg_dump/pg_backup_directory.c b/src/bin/pg_dump/pg_backup_directory.c
index 629e309abe..32dcb12fdf 100644
--- a/src/bin/pg_dump/pg_backup_directory.c
+++ b/src/bin/pg_dump/pg_backup_directory.c
@@ -178,7 +178,7 @@ InitArchiveFmt_Directory(ArchiveHandle *AH)
/* Nothing else in the file, so close it again... */
if (cfclose(tocFH) != 0)
exit_horribly(modulename, "could not close TOC file: %s\n",
- strerror(errno));
+ strerror(errno));
ctx->dataFH = NULL;
}
}
@@ -347,7 +347,7 @@ _PrintFileData(ArchiveHandle *AH, char *filename, RestoreOptions *ropt)
if (!cfp)
exit_horribly(modulename, "could not open input file \"%s\": %s\n",
- filename, strerror(errno));
+ filename, strerror(errno));
buf = pg_malloc(ZLIB_OUT_SIZE);
buflen = ZLIB_OUT_SIZE;
@@ -356,9 +356,9 @@ _PrintFileData(ArchiveHandle *AH, char *filename, RestoreOptions *ropt)
ahwrite(buf, 1, cnt, AH);
free(buf);
- if (cfclose(cfp) != 0)
+ if (cfclose(cfp) !=0)
exit_horribly(modulename, "could not close data file: %s\n",
- strerror(errno));
+ strerror(errno));
}
/*
@@ -417,7 +417,7 @@ _LoadBlobs(ArchiveHandle *AH, RestoreOptions *ropt)
}
if (!cfeof(ctx->blobsTocFH))
exit_horribly(modulename, "error reading large object TOC file \"%s\"\n",
- fname);
+ fname);
if (cfclose(ctx->blobsTocFH) != 0)
exit_horribly(modulename, "could not close large object TOC file \"%s\": %s\n",
@@ -478,7 +478,7 @@ _WriteBuf(ArchiveHandle *AH, const void *buf, size_t len)
res = cfwrite(buf, len, ctx->dataFH);
if (res != len)
exit_horribly(modulename, "could not write to output file: %s\n",
- strerror(errno));
+ strerror(errno));
return res;
}
@@ -589,7 +589,7 @@ _StartBlob(ArchiveHandle *AH, TocEntry *te, Oid oid)
if (ctx->dataFH == NULL)
exit_horribly(modulename, "could not open output file \"%s\": %s\n",
- fname, strerror(errno));
+ fname, strerror(errno));
}
/*
diff --git a/src/bin/pg_dump/pg_backup_tar.c b/src/bin/pg_dump/pg_backup_tar.c
index 9fe2b14df5..c5e19968b7 100644
--- a/src/bin/pg_dump/pg_backup_tar.c
+++ b/src/bin/pg_dump/pg_backup_tar.c
@@ -111,7 +111,7 @@ static void tarClose(ArchiveHandle *AH, TAR_MEMBER *TH);
#ifdef __NOT_USED__
static char *tarGets(char *buf, size_t len, TAR_MEMBER *th);
#endif
-static int tarPrintf(ArchiveHandle *AH, TAR_MEMBER *th, const char *fmt, ...) __attribute__((format(PG_PRINTF_ATTRIBUTE, 3, 4)));
+static int tarPrintf(ArchiveHandle *AH, TAR_MEMBER *th, const char *fmt,...) __attribute__((format(PG_PRINTF_ATTRIBUTE, 3, 4)));
static void _tarAddFile(ArchiveHandle *AH, TAR_MEMBER *th);
static int _tarChecksum(char *th);
@@ -177,7 +177,7 @@ InitArchiveFmt_Tar(ArchiveHandle *AH)
ctx->tarFH = fopen(AH->fSpec, PG_BINARY_W);
if (ctx->tarFH == NULL)
exit_horribly(modulename,
- "could not open TOC file \"%s\" for output: %s\n",
+ "could not open TOC file \"%s\" for output: %s\n",
AH->fSpec, strerror(errno));
}
else
@@ -213,7 +213,7 @@ InitArchiveFmt_Tar(ArchiveHandle *AH)
*/
if (AH->compression != 0)
exit_horribly(modulename,
- "compression is not supported by tar archive format\n");
+ "compression is not supported by tar archive format\n");
}
else
{ /* Read Mode */
@@ -585,7 +585,7 @@ tarWrite(const void *buf, size_t len, TAR_MEMBER *th)
if (res != len)
exit_horribly(modulename,
- "could not write to output file: %s\n", strerror(errno));
+ "could not write to output file: %s\n", strerror(errno));
th->pos += res;
return res;
@@ -1230,7 +1230,7 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th)
snprintf(buf2, sizeof(buf2), INT64_FORMAT, (int64) ftello(ctx->tarFHpos));
exit_horribly(modulename,
"mismatch in actual vs. predicted file position (%s vs. %s)\n",
- buf1, buf2);
+ buf1, buf2);
}
#endif
@@ -1245,7 +1245,7 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th)
if (len != 512)
exit_horribly(modulename,
ngettext("incomplete tar header found (%lu byte)\n",
- "incomplete tar header found (%lu bytes)\n",
+ "incomplete tar header found (%lu bytes)\n",
len),
(unsigned long) len);
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 3461f3e34c..d9aeee3c8d 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -221,9 +221,9 @@ static char *format_function_arguments_old(Archive *fout,
char **argmodes,
char **argnames);
static char *format_function_signature(Archive *fout,
- FuncInfo *finfo, bool honor_quotes);
+ FuncInfo *finfo, bool honor_quotes);
static const char *convertRegProcReference(Archive *fout,
- const char *proc);
+ const char *proc);
static const char *convertOperatorReference(Archive *fout, const char *opr);
static const char *convertTSFunction(Archive *fout, Oid funcOid);
static Oid findLastBuiltinOid_V71(Archive *fout, const char *);
@@ -232,7 +232,7 @@ static void selectSourceSchema(Archive *fout, const char *schemaName);
static char *getFormattedTypeName(Archive *fout, Oid oid, OidOptions opts);
static char *myFormatType(const char *typname, int32 typmod);
static const char *fmtQualifiedId(Archive *fout,
- const char *schema, const char *id);
+ const char *schema, const char *id);
static void getBlobs(Archive *fout);
static void dumpBlob(Archive *fout, BlobInfo *binfo);
static int dumpBlobs(Archive *fout, void *arg);
@@ -285,7 +285,7 @@ main(int argc, char **argv)
RestoreOptions *ropt;
ArchiveFormat archiveFormat = archUnknown;
ArchiveMode archiveMode;
- Archive *fout; /* the script file */
+ Archive *fout; /* the script file */
static int disable_triggers = 0;
static int outputNoTablespaces = 0;
@@ -495,7 +495,7 @@ main(int argc, char **argv)
use_role = optarg;
break;
- case 4: /* exclude table(s) data */
+ case 4: /* exclude table(s) data */
simple_string_list_append(&tabledata_exclude_patterns, optarg);
break;
@@ -605,7 +605,7 @@ main(int argc, char **argv)
"SERIALIZABLE, READ ONLY, DEFERRABLE");
else
ExecuteSqlStatement(fout,
- "SET TRANSACTION ISOLATION LEVEL "
+ "SET TRANSACTION ISOLATION LEVEL "
"REPEATABLE READ");
}
else
@@ -625,7 +625,7 @@ main(int argc, char **argv)
{
if (fout->remoteVersion >= 70100)
g_last_builtin_oid = findLastBuiltinOid_V71(fout,
- PQdb(GetConnection(fout)));
+ PQdb(GetConnection(fout)));
else
g_last_builtin_oid = findLastBuiltinOid_V70(fout);
if (g_verbose)
@@ -748,7 +748,7 @@ main(int argc, char **argv)
else
ropt->compression = compressLevel;
- ropt->suppressDumpWarnings = true; /* We've already shown them */
+ ropt->suppressDumpWarnings = true; /* We've already shown them */
SetArchiveRestoreOptions(fout, ropt);
@@ -1123,6 +1123,7 @@ selectDumpableType(TypeInfo *tyinfo)
if (tyinfo->isArray)
{
tyinfo->dobj.objType = DO_DUMMY_TYPE;
+
/*
* Fall through to set the dump flag; we assume that the subsequent
* rules will do the same thing as they would for the array's base
@@ -2666,7 +2667,7 @@ findNamespace(Archive *fout, Oid nsoid, Oid objoid)
else
{
/* This code depends on the dummy objects set up by getNamespaces. */
- Oid i;
+ Oid i;
if (objoid > g_last_builtin_oid)
i = 0; /* user object */
@@ -2938,7 +2939,7 @@ getTypes(Archive *fout, int *numTypes)
/*
* If it's a base type, make a DumpableObject representing a shell
* definition of the type. We will need to dump that ahead of the I/O
- * functions for the type. Similarly, range types need a shell
+ * functions for the type. Similarly, range types need a shell
* definition in case they have a canonicalize function.
*
* Note: the shell type doesn't have a catId. You might think it
@@ -3972,7 +3973,7 @@ getTables(Archive *fout, int *numTables)
"SELECT c.tableoid, c.oid, c.relname, "
"c.relacl, c.relkind, c.relnamespace, "
"(%s c.relowner) AS rolname, "
- "c.relchecks, (c.reltriggers <> 0) AS relhastriggers, "
+ "c.relchecks, (c.reltriggers <> 0) AS relhastriggers, "
"c.relhasindex, c.relhasrules, c.relhasoids, "
"c.relfrozenxid, tc.oid AS toid, "
"tc.relfrozenxid AS tfrozenxid, "
@@ -4278,9 +4279,9 @@ getTables(Archive *fout, int *numTables)
resetPQExpBuffer(query);
appendPQExpBuffer(query,
"LOCK TABLE %s IN ACCESS SHARE MODE",
- fmtQualifiedId(fout,
+ fmtQualifiedId(fout,
tblinfo[i].dobj.namespace->dobj.name,
- tblinfo[i].dobj.name));
+ tblinfo[i].dobj.name));
ExecuteSqlStatement(fout, query->data);
}
@@ -4879,7 +4880,7 @@ getDomainConstraints(Archive *fout, TypeInfo *tyinfo)
for (i = 0; i < ntups; i++)
{
- bool validated = PQgetvalue(res, i, 4)[0] == 't';
+ bool validated = PQgetvalue(res, i, 4)[0] == 't';
constrinfo[i].dobj.objType = DO_CONSTRAINT;
constrinfo[i].dobj.catId.tableoid = atooid(PQgetvalue(res, i, i_tableoid));
@@ -4901,7 +4902,7 @@ getDomainConstraints(Archive *fout, TypeInfo *tyinfo)
/*
* Make the domain depend on the constraint, ensuring it won't be
- * output till any constraint dependencies are OK. If the constraint
+ * output till any constraint dependencies are OK. If the constraint
* has not been validated, it's going to be dumped after the domain
* anyway, so this doesn't matter.
*/
@@ -5625,11 +5626,11 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables)
"pg_catalog.format_type(t.oid,a.atttypmod) AS atttypname, "
"array_to_string(a.attoptions, ', ') AS attoptions, "
"CASE WHEN a.attcollation <> t.typcollation "
- "THEN a.attcollation ELSE 0 END AS attcollation, "
+ "THEN a.attcollation ELSE 0 END AS attcollation, "
"pg_catalog.array_to_string(ARRAY("
"SELECT pg_catalog.quote_ident(option_name) || "
"' ' || pg_catalog.quote_literal(option_value) "
- "FROM pg_catalog.pg_options_to_table(attfdwoptions) "
+ "FROM pg_catalog.pg_options_to_table(attfdwoptions) "
"ORDER BY option_name"
"), E',\n ') AS attfdwoptions "
"FROM pg_catalog.pg_attribute a LEFT JOIN pg_catalog.pg_type t "
@@ -5654,7 +5655,7 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables)
"pg_catalog.format_type(t.oid,a.atttypmod) AS atttypname, "
"array_to_string(a.attoptions, ', ') AS attoptions, "
"CASE WHEN a.attcollation <> t.typcollation "
- "THEN a.attcollation ELSE 0 END AS attcollation, "
+ "THEN a.attcollation ELSE 0 END AS attcollation, "
"NULL AS attfdwoptions "
"FROM pg_catalog.pg_attribute a LEFT JOIN pg_catalog.pg_type t "
"ON a.atttypid = t.oid "
@@ -5898,8 +5899,8 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables)
/*
* Defaults on a VIEW must always be dumped as separate ALTER
* TABLE commands. Defaults on regular tables are dumped as
- * part of the CREATE TABLE if possible, which it won't be
- * if the column is not going to be emitted explicitly.
+ * part of the CREATE TABLE if possible, which it won't be if
+ * the column is not going to be emitted explicitly.
*/
if (tbinfo->relkind == RELKIND_VIEW)
{
@@ -5919,6 +5920,7 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables)
else
{
attrdefs[j].separate = false;
+
/*
* Mark the default as needing to appear before the table,
* so that any dependencies it has must be emitted before
@@ -6051,7 +6053,7 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables)
for (j = 0; j < numConstrs; j++)
{
- bool validated = PQgetvalue(res, j, 5)[0] == 't';
+ bool validated = PQgetvalue(res, j, 5)[0] == 't';
constrs[j].dobj.objType = DO_CONSTRAINT;
constrs[j].dobj.catId.tableoid = atooid(PQgetvalue(res, j, 0));
@@ -6068,6 +6070,7 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables)
constrs[j].condeferrable = false;
constrs[j].condeferred = false;
constrs[j].conislocal = (PQgetvalue(res, j, 4)[0] == 't');
+
/*
* An unvalidated constraint needs to be dumped separately, so
* that potentially-violating existing data is loaded before
@@ -6081,10 +6084,10 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables)
* Mark the constraint as needing to appear before the table
* --- this is so that any other dependencies of the
* constraint will be emitted before we try to create the
- * table. If the constraint is to be dumped separately, it will be
- * dumped after data is loaded anyway, so don't do it. (There's
- * an automatic dependency in the opposite direction anyway, so
- * don't need to add one manually here.)
+ * table. If the constraint is to be dumped separately, it
+ * will be dumped after data is loaded anyway, so don't do it.
+ * (There's an automatic dependency in the opposite direction
+ * anyway, so don't need to add one manually here.)
*/
if (!constrs[j].separate)
addObjectDependency(&tbinfo->dobj,
@@ -6597,7 +6600,7 @@ getForeignServers(Archive *fout, int *numForeignServers)
}
/* Make sure we are in proper schema */
- selectSourceSchema(fout,"pg_catalog");
+ selectSourceSchema(fout, "pg_catalog");
appendPQExpBuffer(query, "SELECT tableoid, oid, srvname, "
"(%s srvowner) AS rolname, "
@@ -7531,7 +7534,7 @@ dumpRangeType(Archive *fout, TypeInfo *tyinfo)
selectSourceSchema(fout, tyinfo->dobj.namespace->dobj.name);
appendPQExpBuffer(query,
- "SELECT pg_catalog.format_type(rngsubtype, NULL) AS rngsubtype, "
+ "SELECT pg_catalog.format_type(rngsubtype, NULL) AS rngsubtype, "
"opc.opcname AS opcname, "
"(SELECT nspname FROM pg_catalog.pg_namespace nsp "
" WHERE nsp.oid = opc.opcnamespace) AS opcnsp, "
@@ -7570,8 +7573,8 @@ dumpRangeType(Archive *fout, TypeInfo *tyinfo)
/* print subtype_opclass only if not default for subtype */
if (PQgetvalue(res, 0, PQfnumber(res, "opcdefault"))[0] != 't')
{
- char *opcname = PQgetvalue(res, 0, PQfnumber(res, "opcname"));
- char *nspname = PQgetvalue(res, 0, PQfnumber(res, "opcnsp"));
+ char *opcname = PQgetvalue(res, 0, PQfnumber(res, "opcname"));
+ char *nspname = PQgetvalue(res, 0, PQfnumber(res, "opcnsp"));
/* always schema-qualify, don't try to be smart */
appendPQExpBuffer(q, ",\n subtype_opclass = %s.",
@@ -9409,12 +9412,12 @@ dumpCast(Archive *fout, CastInfo *cast)
labelq = createPQExpBuffer();
appendPQExpBuffer(delqry, "DROP CAST (%s AS %s);\n",
- getFormattedTypeName(fout, cast->castsource, zeroAsNone),
- getFormattedTypeName(fout, cast->casttarget, zeroAsNone));
+ getFormattedTypeName(fout, cast->castsource, zeroAsNone),
+ getFormattedTypeName(fout, cast->casttarget, zeroAsNone));
appendPQExpBuffer(defqry, "CREATE CAST (%s AS %s) ",
- getFormattedTypeName(fout, cast->castsource, zeroAsNone),
- getFormattedTypeName(fout, cast->casttarget, zeroAsNone));
+ getFormattedTypeName(fout, cast->castsource, zeroAsNone),
+ getFormattedTypeName(fout, cast->casttarget, zeroAsNone));
switch (cast->castmethod)
{
@@ -9427,14 +9430,15 @@ dumpCast(Archive *fout, CastInfo *cast)
case COERCION_METHOD_FUNCTION:
if (funcInfo)
{
- char *fsig = format_function_signature(fout, funcInfo, true);
+ char *fsig = format_function_signature(fout, funcInfo, true);
/*
* Always qualify the function name, in case it is not in
- * pg_catalog schema (format_function_signature won't qualify it).
+ * pg_catalog schema (format_function_signature won't qualify
+ * it).
*/
appendPQExpBuffer(defqry, "WITH FUNCTION %s.%s",
- fmtId(funcInfo->dobj.namespace->dobj.name), fsig);
+ fmtId(funcInfo->dobj.namespace->dobj.name), fsig);
free(fsig);
}
else
@@ -9451,8 +9455,8 @@ dumpCast(Archive *fout, CastInfo *cast)
appendPQExpBuffer(defqry, ";\n");
appendPQExpBuffer(labelq, "CAST (%s AS %s)",
- getFormattedTypeName(fout, cast->castsource, zeroAsNone),
- getFormattedTypeName(fout, cast->casttarget, zeroAsNone));
+ getFormattedTypeName(fout, cast->castsource, zeroAsNone),
+ getFormattedTypeName(fout, cast->casttarget, zeroAsNone));
if (binary_upgrade)
binary_upgrade_extension_member(defqry, &cast->dobj, labelq->data);
@@ -11715,7 +11719,7 @@ dumpACL(Archive *fout, CatalogId objCatId, DumpId objDumpId,
if (!buildACLCommands(name, subname, type, acls, owner,
"", fout->remoteVersion, sql))
exit_horribly(NULL,
- "could not parse ACL list (%s) for object \"%s\" (%s)\n",
+ "could not parse ACL list (%s) for object \"%s\" (%s)\n",
acls, name, type);
if (sql->len > 0)
@@ -12157,10 +12161,10 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
{
if (PQntuples(res) < 1)
exit_horribly(NULL, "query to obtain definition of view \"%s\" returned no data\n",
- tbinfo->dobj.name);
+ tbinfo->dobj.name);
else
exit_horribly(NULL, "query to obtain definition of view \"%s\" returned more than one definition\n",
- tbinfo->dobj.name);
+ tbinfo->dobj.name);
}
viewdef = PQgetvalue(res, 0, 0);
@@ -12207,7 +12211,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
"pg_catalog.array_to_string(ARRAY("
"SELECT pg_catalog.quote_ident(option_name) || "
"' ' || pg_catalog.quote_literal(option_value) "
- "FROM pg_catalog.pg_options_to_table(ftoptions) "
+ "FROM pg_catalog.pg_options_to_table(ftoptions) "
"ORDER BY option_name"
"), E',\n ') AS ftoptions "
"FROM pg_catalog.pg_foreign_table ft "
@@ -13152,7 +13156,7 @@ findLastBuiltinOid_V70(Archive *fout)
int last_oid;
res = ExecuteSqlQueryForSingleRow(fout,
- "SELECT oid FROM pg_class WHERE relname = 'pg_indexes'");
+ "SELECT oid FROM pg_class WHERE relname = 'pg_indexes'");
last_oid = atooid(PQgetvalue(res, 0, PQfnumber(res, "oid")));
PQclear(res);
return last_oid;
@@ -13882,8 +13886,8 @@ getExtensionMembership(Archive *fout, ExtensionInfo extinfo[],
continue;
/*
- * Note: config tables are dumped without OIDs regardless
- * of the --oids setting. This is because row filtering
+ * Note: config tables are dumped without OIDs regardless of
+ * the --oids setting. This is because row filtering
* conditions aren't compatible with dumping OIDs.
*/
makeTableDataInfo(configtbl, false);
@@ -14284,7 +14288,7 @@ ExecuteSqlQueryForSingleRow(Archive *fout, char *query)
exit_horribly(NULL,
ngettext("query returned %d row instead of one: %s\n",
"query returned %d rows instead of one: %s\n",
- ntups),
+ ntups),
ntups, query);
return res;
diff --git a/src/bin/pg_dump/pg_dump_sort.c b/src/bin/pg_dump/pg_dump_sort.c
index 2a1b4299ca..9a82e4b6c5 100644
--- a/src/bin/pg_dump/pg_dump_sort.c
+++ b/src/bin/pg_dump/pg_dump_sort.c
@@ -111,7 +111,7 @@ static bool TopoSort(DumpableObject **objs,
static void addHeapElement(int val, int *heap, int heapLength);
static int removeHeapElement(int *heap, int heapLength);
static void findDependencyLoops(DumpableObject **objs, int nObjs, int totObjs);
-static int findLoop(DumpableObject *obj,
+static int findLoop(DumpableObject *obj,
DumpId startPoint,
bool *processed,
DumpableObject **workspace,
@@ -139,8 +139,8 @@ sortDumpableObjectsByTypeName(DumpableObject **objs, int numObjs)
static int
DOTypeNameCompare(const void *p1, const void *p2)
{
- DumpableObject *obj1 = *(DumpableObject * const *) p1;
- DumpableObject *obj2 = *(DumpableObject * const *) p2;
+ DumpableObject *obj1 = *(DumpableObject *const *) p1;
+ DumpableObject *obj2 = *(DumpableObject *const *) p2;
int cmpval;
/* Sort by type */
@@ -171,8 +171,8 @@ DOTypeNameCompare(const void *p1, const void *p2)
/* To have a stable sort order, break ties for some object types */
if (obj1->objType == DO_FUNC || obj1->objType == DO_AGG)
{
- FuncInfo *fobj1 = *(FuncInfo * const *) p1;
- FuncInfo *fobj2 = *(FuncInfo * const *) p2;
+ FuncInfo *fobj1 = *(FuncInfo *const *) p1;
+ FuncInfo *fobj2 = *(FuncInfo *const *) p2;
cmpval = fobj1->nargs - fobj2->nargs;
if (cmpval != 0)
@@ -180,8 +180,8 @@ DOTypeNameCompare(const void *p1, const void *p2)
}
else if (obj1->objType == DO_OPERATOR)
{
- OprInfo *oobj1 = *(OprInfo * const *) p1;
- OprInfo *oobj2 = *(OprInfo * const *) p2;
+ OprInfo *oobj1 = *(OprInfo *const *) p1;
+ OprInfo *oobj2 = *(OprInfo *const *) p2;
/* oprkind is 'l', 'r', or 'b'; this sorts prefix, postfix, infix */
cmpval = (oobj2->oprkind - oobj1->oprkind);
@@ -190,8 +190,8 @@ DOTypeNameCompare(const void *p1, const void *p2)
}
else if (obj1->objType == DO_ATTRDEF)
{
- AttrDefInfo *adobj1 = *(AttrDefInfo * const *) p1;
- AttrDefInfo *adobj2 = *(AttrDefInfo * const *) p2;
+ AttrDefInfo *adobj1 = *(AttrDefInfo *const *) p1;
+ AttrDefInfo *adobj2 = *(AttrDefInfo *const *) p2;
cmpval = (adobj1->adnum - adobj2->adnum);
if (cmpval != 0)
@@ -220,8 +220,8 @@ sortDumpableObjectsByTypeOid(DumpableObject **objs, int numObjs)
static int
DOTypeOidCompare(const void *p1, const void *p2)
{
- DumpableObject *obj1 = *(DumpableObject * const *) p1;
- DumpableObject *obj2 = *(DumpableObject * const *) p2;
+ DumpableObject *obj1 = *(DumpableObject *const *) p1;
+ DumpableObject *obj2 = *(DumpableObject *const *) p2;
int cmpval;
cmpval = oldObjectTypePriority[obj1->objType] -
@@ -545,7 +545,7 @@ findDependencyLoops(DumpableObject **objs, int nObjs, int totObjs)
{
/*
* There's no loop starting at this object, but mark it processed
- * anyway. This is not necessary for correctness, but saves later
+ * anyway. This is not necessary for correctness, but saves later
* invocations of findLoop() from uselessly chasing references to
* such an object.
*/
@@ -587,7 +587,7 @@ findLoop(DumpableObject *obj,
int i;
/*
- * Reject if obj is already processed. This test prevents us from finding
+ * Reject if obj is already processed. This test prevents us from finding
* loops that overlap previously-processed loops.
*/
if (processed[obj->dumpId])
@@ -645,7 +645,7 @@ findLoop(DumpableObject *obj,
* A user-defined datatype will have a dependency loop with each of its
* I/O functions (since those have the datatype as input or output).
* Similarly, a range type will have a loop with its canonicalize function,
- * if any. Break the loop by making the function depend on the associated
+ * if any. Break the loop by making the function depend on the associated
* shell type, instead.
*/
static void
diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c
index 34d6920364..053e5fd36a 100644
--- a/src/bin/pg_dump/pg_dumpall.c
+++ b/src/bin/pg_dump/pg_dumpall.c
@@ -52,8 +52,8 @@ static void doShellQuoting(PQExpBuffer buf, const char *str);
static int runPgDump(const char *dbname);
static void buildShSecLabels(PGconn *conn, const char *catalog_name,
- uint32 objectId, PQExpBuffer buffer,
- const char *target, const char *objname);
+ uint32 objectId, PQExpBuffer buffer,
+ const char *target, const char *objname);
static PGconn *connectDatabase(const char *dbname, const char *pghost, const char *pgport,
const char *pguser, enum trivalue prompt_password, bool fail_on_error);
static PGresult *executeQuery(PGconn *conn, const char *query);
@@ -1663,7 +1663,7 @@ static void
buildShSecLabels(PGconn *conn, const char *catalog_name, uint32 objectId,
PQExpBuffer buffer, const char *target, const char *objname)
{
- PQExpBuffer sql = createPQExpBuffer();
+ PQExpBuffer sql = createPQExpBuffer();
PGresult *res;
buildShSecLabelQuery(conn, catalog_name, objectId, sql);