Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorBruce Momjian2013-05-29 20:58:43 +0000
committerBruce Momjian2013-05-29 20:58:43 +0000
commit9af4159fce6654aa0e081b00d02bca40b978745c (patch)
tree3aa507fc6cc67ed3d9f6ceec4d65d1e56cc08e1a /src/bin
parent07ab261ef3a9575a4a2bd3045b222d7b3dee2c46 (diff)
pgindent run for release 9.3
This is the first run of the Perl-based pgindent script. Also update pgindent instructions.
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/initdb/initdb.c60
-rw-r--r--src/bin/pg_basebackup/pg_basebackup.c21
-rw-r--r--src/bin/pg_basebackup/pg_receivexlog.c2
-rw-r--r--src/bin/pg_basebackup/receivelog.c93
-rw-r--r--src/bin/pg_basebackup/streamutil.c3
-rw-r--r--src/bin/pg_ctl/pg_ctl.c15
-rw-r--r--src/bin/pg_dump/parallel.c14
-rw-r--r--src/bin/pg_dump/parallel.h4
-rw-r--r--src/bin/pg_dump/pg_backup_archiver.c2
-rw-r--r--src/bin/pg_dump/pg_backup_archiver.h4
-rw-r--r--src/bin/pg_dump/pg_dump.c18
-rw-r--r--src/bin/pg_dump/pg_dump.h2
-rw-r--r--src/bin/pg_resetxlog/pg_resetxlog.c1
-rw-r--r--src/bin/pgevent/pgevent.c1
-rw-r--r--src/bin/psql/command.c6
-rw-r--r--src/bin/psql/copy.c14
-rw-r--r--src/bin/psql/create_help.pl3
-rw-r--r--src/bin/psql/describe.c46
-rw-r--r--src/bin/psql/print.c6
-rw-r--r--src/bin/psql/startup.c12
-rw-r--r--src/bin/psql/tab-complete.c14
-rw-r--r--src/bin/scripts/pg_isready.c41
22 files changed, 199 insertions, 183 deletions
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index f9b3492ef31..9ff96c63b3f 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -209,7 +209,7 @@ static char **filter_lines_with_token(char **lines, const char *token);
#endif
static char **readfile(const char *path);
static void writefile(char *path, char **lines);
-static void walkdir(char *path, void (*action)(char *fname, bool isdir));
+static void walkdir(char *path, void (*action) (char *fname, bool isdir));
static void pre_sync_fname(char *fname, bool isdir);
static void fsync_fname(char *fname, bool isdir);
static FILE *popen_check(const char *command, const char *mode);
@@ -249,17 +249,17 @@ static bool check_locale_name(int category, const char *locale,
static bool check_locale_encoding(const char *locale, int encoding);
static void setlocales(void);
static void usage(const char *progname);
-void get_restricted_token(void);
-void setup_pgdata(void);
-void setup_bin_paths(const char *argv0);
-void setup_data_file_paths(void);
-void setup_locale_encoding(void);
-void setup_signals(void);
-void setup_text_search(void);
-void create_data_directory(void);
-void create_xlog_symlink(void);
-void warn_on_mount_point(int error);
-void initialize_data_directory(void);
+void get_restricted_token(void);
+void setup_pgdata(void);
+void setup_bin_paths(const char *argv0);
+void setup_data_file_paths(void);
+void setup_locale_encoding(void);
+void setup_signals(void);
+void setup_text_search(void);
+void create_data_directory(void);
+void create_xlog_symlink(void);
+void warn_on_mount_point(int error);
+void initialize_data_directory(void);
#ifdef WIN32
@@ -320,7 +320,8 @@ do { \
static char *
escape_quotes(const char *src)
{
- char *result = escape_single_quotes_ascii(src);
+ char *result = escape_single_quotes_ascii(src);
+
if (!result)
{
fprintf(stderr, _("%s: out of memory\n"), progname);
@@ -556,6 +557,7 @@ walkdir(char *path, void (*action) (char *fname, bool isdir))
}
#ifdef WIN32
+
/*
* This fix is in mingw cvs (runtime/mingwex/dirent.c rev 1.4), but not in
* released version
@@ -576,7 +578,7 @@ walkdir(char *path, void (*action) (char *fname, bool isdir))
/*
* It's important to fsync the destination directory itself as individual
* file fsyncs don't guarantee that the directory entry for the file is
- * synced. Recent versions of ext4 have made the window much wider but
+ * synced. Recent versions of ext4 have made the window much wider but
* it's been an issue for ext3 and other filesystems in the past.
*/
(*action) (path, true);
@@ -590,7 +592,7 @@ pre_sync_fname(char *fname, bool isdir)
{
#if defined(HAVE_SYNC_FILE_RANGE) || \
(defined(USE_POSIX_FADVISE) && defined(POSIX_FADV_DONTNEED))
- int fd;
+ int fd;
fd = open(fname, O_RDONLY | PG_BINARY);
@@ -609,7 +611,7 @@ pre_sync_fname(char *fname, bool isdir)
}
/*
- * Prefer sync_file_range, else use posix_fadvise. We ignore any error
+ * Prefer sync_file_range, else use posix_fadvise. We ignore any error
* here since this operation is only a hint anyway.
*/
#if defined(HAVE_SYNC_FILE_RANGE)
@@ -901,7 +903,7 @@ find_matching_ts_config(const char *lc_type)
* underscore (usual case) or a hyphen (Windows "locale name"; see
* comments at IsoLocaleName()).
*
- * XXX Should ' ' be a stop character? This would select "norwegian" for
+ * XXX Should ' ' be a stop character? This would select "norwegian" for
* the Windows locale "Norwegian (Nynorsk)_Norway.1252". If we do so, we
* should also accept the "nn" and "nb" Unix locales.
*
@@ -2819,6 +2821,7 @@ void
get_restricted_token(void)
{
#ifdef WIN32
+
/*
* Before we execute another program, make sure that we are running with a
* restricted token. If not, re-execute ourselves with one.
@@ -2865,7 +2868,8 @@ get_restricted_token(void)
void
setup_pgdata(void)
{
- char *pgdata_get_env, *pgdata_set_env;
+ char *pgdata_get_env,
+ *pgdata_set_env;
if (strlen(pg_data) == 0)
{
@@ -2905,7 +2909,7 @@ setup_pgdata(void)
void
setup_bin_paths(const char *argv0)
{
- int ret;
+ int ret;
if ((ret = find_other_exec(argv0, "postgres", PG_BACKEND_VERSIONSTR,
backend_exec)) < 0)
@@ -3149,7 +3153,7 @@ setup_signals(void)
void
create_data_directory(void)
{
- int ret;
+ int ret;
switch ((ret = pg_check_dir(pg_data)))
{
@@ -3278,8 +3282,8 @@ create_xlog_symlink(void)
warn_on_mount_point(ret);
else
fprintf(stderr,
- _("If you want to store the transaction log there, either\n"
- "remove or empty the directory \"%s\".\n"),
+ _("If you want to store the transaction log there, either\n"
+ "remove or empty the directory \"%s\".\n"),
xlog_dir);
exit_nicely();
@@ -3328,12 +3332,12 @@ warn_on_mount_point(int error)
void
initialize_data_directory(void)
{
- int i;
+ int i;
setup_signals();
umask(S_IRWXG | S_IRWXO);
-
+
create_data_directory();
create_xlog_symlink();
@@ -3587,7 +3591,7 @@ main(int argc, char *argv[])
perform_fsync();
return 0;
}
-
+
if (pwprompt && pwfilename)
{
fprintf(stderr, _("%s: password prompt and password file cannot be specified together\n"), progname);
@@ -3607,7 +3611,7 @@ main(int argc, char *argv[])
setup_pgdata();
setup_bin_paths(argv[0]);
-
+
effective_user = get_id();
if (strlen(username) == 0)
username = effective_user;
@@ -3629,11 +3633,11 @@ main(int argc, char *argv[])
printf(_("Data page checksums are enabled.\n"));
else
printf(_("Data page checksums are disabled.\n"));
-
+
printf("\n");
initialize_data_directory();
-
+
if (do_sync)
perform_fsync();
else
diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.c
index 84c34979228..1e22969d552 100644
--- a/src/bin/pg_basebackup/pg_basebackup.c
+++ b/src/bin/pg_basebackup/pg_basebackup.c
@@ -444,7 +444,7 @@ progress_report(int tablespacenum, const char *filename)
VERBOSE_FILENAME_LENGTH + 5, "");
else
{
- bool truncate = (strlen(filename) > VERBOSE_FILENAME_LENGTH);
+ bool truncate = (strlen(filename) > VERBOSE_FILENAME_LENGTH);
fprintf(stderr,
ngettext("%*s/%s kB (%d%%), %d/%d tablespace (%s%-*.*s)",
@@ -453,11 +453,11 @@ progress_report(int tablespacenum, const char *filename)
(int) strlen(totalsize_str),
totaldone_str, totalsize_str, percent,
tablespacenum, tablespacecount,
- /* Prefix with "..." if we do leading truncation */
+ /* Prefix with "..." if we do leading truncation */
truncate ? "..." : "",
- truncate ? VERBOSE_FILENAME_LENGTH - 3 : VERBOSE_FILENAME_LENGTH,
- truncate ? VERBOSE_FILENAME_LENGTH - 3 : VERBOSE_FILENAME_LENGTH,
- /* Truncate filename at beginning if it's too long */
+ truncate ? VERBOSE_FILENAME_LENGTH - 3 : VERBOSE_FILENAME_LENGTH,
+ truncate ? VERBOSE_FILENAME_LENGTH - 3 : VERBOSE_FILENAME_LENGTH,
+ /* Truncate filename at beginning if it's too long */
truncate ? filename + strlen(filename) - VERBOSE_FILENAME_LENGTH + 3 : filename);
}
}
@@ -1145,7 +1145,7 @@ escapeConnectionParameter(const char *src)
return pg_strdup("''");
if (!need_quotes && !need_escaping)
- return pg_strdup(src); /* no quoting or escaping needed */
+ return pg_strdup(src); /* no quoting or escaping needed */
/*
* Allocate a buffer large enough for the worst case that all the source
@@ -1320,8 +1320,8 @@ BaseBackup(void)
exit(1);
/*
- * Check server version. BASE_BACKUP command was introduced in 9.1, so
- * we can't work with servers older than 9.1.
+ * Check server version. BASE_BACKUP command was introduced in 9.1, so we
+ * can't work with servers older than 9.1.
*/
minServerMajor = 901;
maxServerMajor = PG_VERSION_NUM / 100;
@@ -1329,6 +1329,7 @@ BaseBackup(void)
if (serverMajor < minServerMajor || serverMajor > maxServerMajor)
{
const char *serverver = PQparameterStatus(conn, "server_version");
+
fprintf(stderr, _("%s: incompatible server version %s\n"),
progname, serverver ? serverver : "'unknown'");
disconnect_and_exit(1);
@@ -1409,9 +1410,11 @@ BaseBackup(void)
}
strcpy(xlogstart, PQgetvalue(res, 0, 0));
+
/*
* 9.3 and later sends the TLI of the starting point. With older servers,
- * assume it's the same as the latest timeline reported by IDENTIFY_SYSTEM.
+ * assume it's the same as the latest timeline reported by
+ * IDENTIFY_SYSTEM.
*/
if (PQnfields(res) >= 2)
starttli = atoi(PQgetvalue(res, 0, 1));
diff --git a/src/bin/pg_basebackup/pg_receivexlog.c b/src/bin/pg_basebackup/pg_receivexlog.c
index fa0ac5184c1..18507877845 100644
--- a/src/bin/pg_basebackup/pg_receivexlog.c
+++ b/src/bin/pg_basebackup/pg_receivexlog.c
@@ -458,7 +458,7 @@ main(int argc, char **argv)
else
{
fprintf(stderr,
- /* translator: check source for value for %d */
+ /* translator: check source for value for %d */
_("%s: disconnected; waiting %d seconds to try again\n"),
progname, RECONNECT_SLEEP_TIME);
pg_usleep(RECONNECT_SLEEP_TIME * 1000000);
diff --git a/src/bin/pg_basebackup/receivelog.c b/src/bin/pg_basebackup/receivelog.c
index 98e874f4ffe..7ce81125bfe 100644
--- a/src/bin/pg_basebackup/receivelog.c
+++ b/src/bin/pg_basebackup/receivelog.c
@@ -30,11 +30,11 @@
/* fd and filename for currently open WAL file */
static int walfile = -1;
-static char current_walfile_name[MAXPGPATH] = "";
+static char current_walfile_name[MAXPGPATH] = "";
static PGresult *HandleCopyStream(PGconn *conn, XLogRecPtr startpos,
uint32 timeline, char *basedir,
- stream_stop_callback stream_stop, int standby_message_timeout,
+ stream_stop_callback stream_stop, int standby_message_timeout,
char *partial_suffix, XLogRecPtr *stoppos);
static bool ReadEndOfStreamingResult(PGresult *res, XLogRecPtr *startpos,
@@ -200,7 +200,7 @@ close_walfile(char *basedir, char *partial_suffix)
static int64
localGetCurrentTimestamp(void)
{
- int64 result;
+ int64 result;
struct timeval tp;
gettimeofday(&tp, NULL);
@@ -221,7 +221,7 @@ static void
localTimestampDifference(int64 start_time, int64 stop_time,
long *secs, int *microsecs)
{
- int64 diff = stop_time - start_time;
+ int64 diff = stop_time - start_time;
if (diff <= 0)
{
@@ -244,7 +244,7 @@ localTimestampDifferenceExceeds(int64 start_time,
int64 stop_time,
int msec)
{
- int64 diff = stop_time - start_time;
+ int64 diff = stop_time - start_time;
return (diff >= msec * INT64CONST(1000));
}
@@ -309,7 +309,7 @@ writeTimeLineHistoryFile(char *basedir, TimeLineID tli, char *filename, char *co
/*
* Write into a temp file name.
*/
- snprintf(tmppath, MAXPGPATH, "%s.tmp", path);
+ snprintf(tmppath, MAXPGPATH, "%s.tmp", path);
unlink(tmppath);
@@ -414,19 +414,19 @@ static bool
sendFeedback(PGconn *conn, XLogRecPtr blockpos, int64 now, bool replyRequested)
{
char replybuf[1 + 8 + 8 + 8 + 8 + 1];
- int len = 0;
+ int len = 0;
replybuf[len] = 'r';
len += 1;
- sendint64(blockpos, &replybuf[len]); /* write */
+ sendint64(blockpos, &replybuf[len]); /* write */
len += 8;
- sendint64(InvalidXLogRecPtr, &replybuf[len]); /* flush */
+ sendint64(InvalidXLogRecPtr, &replybuf[len]); /* flush */
len += 8;
- sendint64(InvalidXLogRecPtr, &replybuf[len]); /* apply */
+ sendint64(InvalidXLogRecPtr, &replybuf[len]); /* apply */
len += 8;
- sendint64(now, &replybuf[len]); /* sendTime */
+ sendint64(now, &replybuf[len]); /* sendTime */
len += 8;
- replybuf[len] = replyRequested ? 1 : 0; /* replyRequested */
+ replybuf[len] = replyRequested ? 1 : 0; /* replyRequested */
len += 1;
if (PQputCopyData(conn, replybuf, len) <= 0 || PQflush(conn))
@@ -464,6 +464,7 @@ CheckServerVersionForStreaming(PGconn *conn)
if (serverMajor < minServerMajor || serverMajor > maxServerMajor)
{
const char *serverver = PQparameterStatus(conn, "server_version");
+
fprintf(stderr, _("%s: incompatible server version %s; streaming is only supported with server version %s\n"),
progname,
serverver ? serverver : "'unknown'",
@@ -550,7 +551,7 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
if (timeline > atoi(PQgetvalue(res, 0, 1)))
{
fprintf(stderr,
- _("%s: starting timeline %u is not present in the server\n"),
+ _("%s: starting timeline %u is not present in the server\n"),
progname, timeline);
PQclear(res);
return false;
@@ -561,8 +562,8 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
while (1)
{
/*
- * Fetch the timeline history file for this timeline, if we don't
- * have it already.
+ * Fetch the timeline history file for this timeline, if we don't have
+ * it already.
*/
if (!existsTimeLineHistoryFile(basedir, timeline))
{
@@ -572,7 +573,7 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
{
/* FIXME: we might send it ok, but get an error */
fprintf(stderr, _("%s: could not send replication command \"%s\": %s"),
- progname, "TIMELINE_HISTORY", PQresultErrorMessage(res));
+ progname, "TIMELINE_HISTORY", PQresultErrorMessage(res));
PQclear(res);
return false;
}
@@ -585,7 +586,7 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
{
fprintf(stderr,
_("%s: unexpected response to TIMELINE_HISTORY command: got %d rows and %d fields, expected %d rows and %d fields\n"),
- progname, PQntuples(res), PQnfields(res), 1, 2);
+ progname, PQntuples(res), PQnfields(res), 1, 2);
}
/* Write the history file to disk */
@@ -597,8 +598,8 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
}
/*
- * Before we start streaming from the requested location, check
- * if the callback tells us to stop here.
+ * Before we start streaming from the requested location, check if the
+ * callback tells us to stop here.
*/
if (stream_stop(startpos, timeline, false))
return true;
@@ -627,8 +628,8 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
/*
* Streaming finished.
*
- * There are two possible reasons for that: a controlled shutdown,
- * or we reached the end of the current timeline. In case of
+ * There are two possible reasons for that: a controlled shutdown, or
+ * we reached the end of the current timeline. In case of
* end-of-timeline, the server sends a result set after Copy has
* finished, containing information about the next timeline. Read
* that, and restart streaming from the next timeline. In case of
@@ -667,7 +668,7 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
_("%s: server stopped streaming timeline %u at %X/%X, but reported next timeline %u to begin at %X/%X\n"),
progname,
timeline, (uint32) (stoppos >> 32), (uint32) stoppos,
- newtimeline, (uint32) (startpos >> 32), (uint32) startpos);
+ newtimeline, (uint32) (startpos >> 32), (uint32) startpos);
goto error;
}
@@ -676,15 +677,15 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
if (PQresultStatus(res) != PGRES_COMMAND_OK)
{
fprintf(stderr,
- _("%s: unexpected termination of replication stream: %s"),
+ _("%s: unexpected termination of replication stream: %s"),
progname, PQresultErrorMessage(res));
goto error;
}
PQclear(res);
/*
- * Loop back to start streaming from the new timeline.
- * Always start streaming at the beginning of a segment.
+ * Loop back to start streaming from the new timeline. Always
+ * start streaming at the beginning of a segment.
*/
timeline = newtimeline;
startpos = startpos - (startpos % XLOG_SEG_SIZE);
@@ -738,9 +739,9 @@ ReadEndOfStreamingResult(PGresult *res, XLogRecPtr *startpos, uint32 *timeline)
/*----------
* The result set consists of one row and two columns, e.g:
*
- * next_tli | next_tli_startpos
+ * next_tli | next_tli_startpos
* ----------+-------------------
- * 4 | 0/9949AE0
+ * 4 | 0/9949AE0
*
* next_tli is the timeline ID of the next timeline after the one that
* just finished streaming. next_tli_startpos is the XLOG position where
@@ -760,7 +761,7 @@ ReadEndOfStreamingResult(PGresult *res, XLogRecPtr *startpos, uint32 *timeline)
&startpos_xrecoff) != 2)
{
fprintf(stderr,
- _("%s: could not parse next timeline's starting point \"%s\"\n"),
+ _("%s: could not parse next timeline's starting point \"%s\"\n"),
progname, PQgetvalue(res, 0, 1));
return false;
}
@@ -840,8 +841,8 @@ HandleCopyStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
if (r == 0)
{
/*
- * No data available. Wait for some to appear, but not longer
- * than the specified timeout, so that we can ping the server.
+ * No data available. Wait for some to appear, but not longer than
+ * the specified timeout, so that we can ping the server.
*/
fd_set input_mask;
struct timeval timeout;
@@ -875,8 +876,8 @@ HandleCopyStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
{
/*
* Got a timeout or signal. Continue the loop and either
- * deliver a status packet to the server or just go back
- * into blocking.
+ * deliver a status packet to the server or just go back into
+ * blocking.
*/
continue;
}
@@ -940,17 +941,17 @@ HandleCopyStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
/* Check the message type. */
if (copybuf[0] == 'k')
{
- int pos;
- bool replyRequested;
+ int pos;
+ bool replyRequested;
/*
* Parse the keepalive message, enclosed in the CopyData message.
* We just check if the server requested a reply, and ignore the
* rest.
*/
- pos = 1; /* skip msgtype 'k' */
- pos += 8; /* skip walEnd */
- pos += 8; /* skip sendTime */
+ pos = 1; /* skip msgtype 'k' */
+ pos += 8; /* skip walEnd */
+ pos += 8; /* skip sendTime */
if (r < pos + 1)
{
@@ -983,10 +984,10 @@ HandleCopyStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
* CopyData message. We only need the WAL location field
* (dataStart), the rest of the header is ignored.
*/
- hdr_len = 1; /* msgtype 'w' */
- hdr_len += 8; /* dataStart */
- hdr_len += 8; /* walEnd */
- hdr_len += 8; /* sendTime */
+ hdr_len = 1; /* msgtype 'w' */
+ hdr_len += 8; /* dataStart */
+ hdr_len += 8; /* walEnd */
+ hdr_len += 8; /* sendTime */
if (r < hdr_len + 1)
{
fprintf(stderr, _("%s: streaming header too small: %d\n"),
@@ -999,8 +1000,8 @@ HandleCopyStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
xlogoff = blockpos % XLOG_SEG_SIZE;
/*
- * Verify that the initial location in the stream matches where
- * we think we are.
+ * Verify that the initial location in the stream matches where we
+ * think we are.
*/
if (walfile == -1)
{
@@ -1020,8 +1021,8 @@ HandleCopyStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
if (lseek(walfile, 0, SEEK_CUR) != xlogoff)
{
fprintf(stderr,
- _("%s: got WAL data offset %08x, expected %08x\n"),
- progname, xlogoff, (int) lseek(walfile, 0, SEEK_CUR));
+ _("%s: got WAL data offset %08x, expected %08x\n"),
+ progname, xlogoff, (int) lseek(walfile, 0, SEEK_CUR));
goto error;
}
}
@@ -1087,7 +1088,7 @@ HandleCopyStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
goto error;
}
still_sending = false;
- break; /* ignore the rest of this XLogData packet */
+ break; /* ignore the rest of this XLogData packet */
}
}
}
diff --git a/src/bin/pg_basebackup/streamutil.c b/src/bin/pg_basebackup/streamutil.c
index a878dd43451..6891c2c8105 100644
--- a/src/bin/pg_basebackup/streamutil.c
+++ b/src/bin/pg_basebackup/streamutil.c
@@ -48,8 +48,7 @@ GetConnection(void)
/*
* Merge the connection info inputs given in form of connection string,
- * options and default values (dbname=replication, replication=true,
- * etc.)
+ * options and default values (dbname=replication, replication=true, etc.)
*/
i = 0;
if (connection_string)
diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c
index 8113e507cbf..9045e00a1db 100644
--- a/src/bin/pg_ctl/pg_ctl.c
+++ b/src/bin/pg_ctl/pg_ctl.c
@@ -285,7 +285,7 @@ readfile(const char *path)
int i;
int n;
int len;
- struct stat statbuf;
+ struct stat statbuf;
/*
* Slurp the file into memory.
@@ -344,8 +344,9 @@ readfile(const char *path)
{
if (buffer[i] == '\n')
{
- int slen = &buffer[i] - linebegin + 1;
- char *linebuf = pg_malloc(slen + 1);
+ int slen = &buffer[i] - linebegin + 1;
+ char *linebuf = pg_malloc(slen + 1);
+
memcpy(linebuf, linebegin, slen);
linebuf[slen] = '\0';
result[n++] = linebuf;
@@ -1098,10 +1099,10 @@ do_promote(void)
}
/*
- * For 9.3 onwards, use fast promotion as the default option.
- * Promotion with a full checkpoint is still possible by writing
- * a file called "promote", e.g.
- * snprintf(promote_file, MAXPGPATH, "%s/promote", pg_data);
+ * For 9.3 onwards, use fast promotion as the default option. Promotion
+ * with a full checkpoint is still possible by writing a file called
+ * "promote", e.g. snprintf(promote_file, MAXPGPATH, "%s/promote",
+ * pg_data);
*/
snprintf(promote_file, MAXPGPATH, "%s/fast_promote", pg_data);
diff --git a/src/bin/pg_dump/parallel.c b/src/bin/pg_dump/parallel.c
index ae0d329ea21..f005686d8d5 100644
--- a/src/bin/pg_dump/parallel.c
+++ b/src/bin/pg_dump/parallel.c
@@ -110,9 +110,9 @@ static char *readMessageFromPipe(int fd);
#ifdef WIN32
static void shutdown_parallel_dump_utils(int code, void *unused);
-bool parallel_init_done = false;
+bool parallel_init_done = false;
static DWORD tls_index;
-DWORD mainThreadId;
+DWORD mainThreadId;
#endif
@@ -1141,7 +1141,6 @@ select_loop(int maxFd, fd_set *workerset)
if (i)
break;
}
-
#else /* UNIX */
for (;;)
@@ -1163,7 +1162,6 @@ select_loop(int maxFd, fd_set *workerset)
continue;
break;
}
-
#endif
return i;
@@ -1330,7 +1328,7 @@ pgpipe(int handles[2])
serv_addr.sin_family = AF_INET;
serv_addr.sin_port = htons(0);
serv_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
- if (bind(s, (SOCKADDR *) & serv_addr, len) == SOCKET_ERROR)
+ if (bind(s, (SOCKADDR *) &serv_addr, len) == SOCKET_ERROR)
{
write_msg(modulename, "pgpipe could not bind: %ui",
WSAGetLastError());
@@ -1344,7 +1342,7 @@ pgpipe(int handles[2])
closesocket(s);
return -1;
}
- if (getsockname(s, (SOCKADDR *) & serv_addr, &len) == SOCKET_ERROR)
+ if (getsockname(s, (SOCKADDR *) &serv_addr, &len) == SOCKET_ERROR)
{
write_msg(modulename, "pgpipe could not getsockname: %ui",
WSAGetLastError());
@@ -1359,14 +1357,14 @@ pgpipe(int handles[2])
return -1;
}
- if (connect(handles[1], (SOCKADDR *) & serv_addr, len) == SOCKET_ERROR)
+ if (connect(handles[1], (SOCKADDR *) &serv_addr, len) == SOCKET_ERROR)
{
write_msg(modulename, "pgpipe could not connect socket: %ui",
WSAGetLastError());
closesocket(s);
return -1;
}
- if ((handles[0] = accept(s, (SOCKADDR *) & serv_addr, &len)) == INVALID_SOCKET)
+ if ((handles[0] = accept(s, (SOCKADDR *) &serv_addr, &len)) == INVALID_SOCKET)
{
write_msg(modulename, "pgpipe could not accept socket: %ui",
WSAGetLastError());
diff --git a/src/bin/pg_dump/parallel.h b/src/bin/pg_dump/parallel.h
index a7caa6cdbef..dacd696edca 100644
--- a/src/bin/pg_dump/parallel.h
+++ b/src/bin/pg_dump/parallel.h
@@ -30,14 +30,14 @@ typedef enum
WRKR_IDLE,
WRKR_WORKING,
WRKR_FINISHED
-} T_WorkerStatus;
+} T_WorkerStatus;
/* Arguments needed for a worker process */
typedef struct ParallelArgs
{
struct _archiveHandle *AH;
struct _tocEntry *te;
-} ParallelArgs;
+} ParallelArgs;
/* State for each parallel activity slot */
typedef struct ParallelSlot
diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c
index d202b422203..a720afb72cc 100644
--- a/src/bin/pg_dump/pg_backup_archiver.c
+++ b/src/bin/pg_dump/pg_backup_archiver.c
@@ -3812,7 +3812,7 @@ get_next_work_item(ArchiveHandle *AH, TocEntry *ready_list,
* our work is finished, the master process will assign us a new work item.
*/
int
-parallel_restore(ParallelArgs * args)
+parallel_restore(ParallelArgs *args)
{
ArchiveHandle *AH = args->AH;
TocEntry *te = args->te;
diff --git a/src/bin/pg_dump/pg_backup_archiver.h b/src/bin/pg_dump/pg_backup_archiver.h
index 59af815802e..25aa158e5da 100644
--- a/src/bin/pg_dump/pg_backup_archiver.h
+++ b/src/bin/pg_dump/pg_backup_archiver.h
@@ -152,7 +152,7 @@ typedef char *(*WorkerJobDumpPtr) (struct _archiveHandle * AH, struct _tocEntry
typedef char *(*MasterStartParallelItemPtr) (struct _archiveHandle * AH, struct _tocEntry * te,
T_Action act);
typedef int (*MasterEndParallelItemPtr) (struct _archiveHandle * AH, struct _tocEntry * te,
- const char *str, T_Action act);
+ const char *str, T_Action act);
typedef size_t (*CustomOutPtr) (struct _archiveHandle * AH, const void *buf, size_t len);
@@ -360,7 +360,7 @@ typedef struct _tocEntry
int nLockDeps; /* number of such dependencies */
} TocEntry;
-extern int parallel_restore(struct ParallelArgs * args);
+extern int parallel_restore(struct ParallelArgs *args);
extern void on_exit_close_archive(Archive *AHX);
extern void warn_or_exit_horribly(ArchiveHandle *AH, const char *modulename, const char *fmt,...) __attribute__((format(PG_PRINTF_ATTRIBUTE, 3, 4)));
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 76628fcbc39..ec956adc0f1 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -675,8 +675,8 @@ main(int argc, char **argv)
if (numWorkers > 1 && fout->remoteVersion < 90200
&& !no_synchronized_snapshots)
exit_horribly(NULL,
- "Synchronized snapshots are not supported by this server version.\n"
- "Run with --no-synchronized-snapshots instead if you do not need\n"
+ "Synchronized snapshots are not supported by this server version.\n"
+ "Run with --no-synchronized-snapshots instead if you do not need\n"
"synchronized snapshots.\n");
/* Find the last built-in OID, if needed */
@@ -13098,8 +13098,8 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
appendPQExpBuffer(q, "\nOPTIONS (\n %s\n)", ftoptions);
/*
- * For materialized views, create the AS clause just like a view.
- * At this point, we always mark the view as not populated.
+ * For materialized views, create the AS clause just like a view. At
+ * this point, we always mark the view as not populated.
*/
if (tbinfo->relkind == RELKIND_MATVIEW)
{
@@ -14663,7 +14663,7 @@ getExtensionMembership(Archive *fout, ExtensionInfo extinfo[],
/* check table explicitly requested */
if (table_include_oids.head != NULL &&
simple_oid_list_member(&table_include_oids,
- configtbloid))
+ configtbloid))
dumpobj = true;
/* check table's schema explicitly requested */
@@ -14674,19 +14674,19 @@ getExtensionMembership(Archive *fout, ExtensionInfo extinfo[],
/* check table excluded by an exclusion switch */
if (table_exclude_oids.head != NULL &&
simple_oid_list_member(&table_exclude_oids,
- configtbloid))
+ configtbloid))
dumpobj = false;
/* check schema excluded by an exclusion switch */
if (simple_oid_list_member(&schema_exclude_oids,
- configtbl->dobj.namespace->dobj.catId.oid))
+ configtbl->dobj.namespace->dobj.catId.oid))
dumpobj = false;
if (dumpobj)
{
/*
- * 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);
diff --git a/src/bin/pg_dump/pg_dump.h b/src/bin/pg_dump/pg_dump.h
index 6352adaa05e..55825386ea3 100644
--- a/src/bin/pg_dump/pg_dump.h
+++ b/src/bin/pg_dump/pg_dump.h
@@ -236,7 +236,7 @@ typedef struct _tableInfo
char *relacl;
char relkind;
char relpersistence; /* relation persistence */
- bool relispopulated; /* relation is populated */
+ bool relispopulated; /* relation is populated */
char *reltablespace; /* relation tablespace */
char *reloptions; /* options specified by WITH (...) */
char *toast_reloptions; /* ditto, for the TOAST table */
diff --git a/src/bin/pg_resetxlog/pg_resetxlog.c b/src/bin/pg_resetxlog/pg_resetxlog.c
index 9c340b2db59..82018e449f2 100644
--- a/src/bin/pg_resetxlog/pg_resetxlog.c
+++ b/src/bin/pg_resetxlog/pg_resetxlog.c
@@ -192,6 +192,7 @@ main(int argc, char *argv[])
fprintf(stderr, _("%s: multitransaction ID (-m) must not be 0\n"), progname);
exit(1);
}
+
/*
* XXX It'd be nice to have more sanity checks here, e.g. so
* that oldest is not wrapped around w.r.t. nextMulti.
diff --git a/src/bin/pgevent/pgevent.c b/src/bin/pgevent/pgevent.c
index 91d35b4daf1..6a667812fba 100644
--- a/src/bin/pgevent/pgevent.c
+++ b/src/bin/pgevent/pgevent.c
@@ -42,7 +42,6 @@ HRESULT
DllInstall(BOOL bInstall,
LPCWSTR pszCmdLine)
{
-
if (pszCmdLine && *pszCmdLine != '\0')
wcstombs(event_source, pszCmdLine, sizeof(event_source));
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 0e997940328..351e684132c 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -1580,9 +1580,9 @@ do_connect(char *dbname, char *user, char *host, char *port)
if (!o_conn && (!dbname || !user || !host || !port))
{
/*
- * We don't know the supplied connection parameters and don't want
- * to connect to the wrong database by using defaults, so require
- * all parameters to be specified.
+ * We don't know the supplied connection parameters and don't want to
+ * connect to the wrong database by using defaults, so require all
+ * parameters to be specified.
*/
psql_error("All connection parameters must be supplied because no "
"database connection exists\n");
diff --git a/src/bin/psql/copy.c b/src/bin/psql/copy.c
index 57cbf928161..b5732c79709 100644
--- a/src/bin/psql/copy.c
+++ b/src/bin/psql/copy.c
@@ -35,7 +35,7 @@
* \copy ( select stmt ) to filename [options]
*
* where 'filename' can be one of the following:
- * '<file path>' | PROGRAM '<command>' | stdin | stdout | pstdout | pstdout
+ * '<file path>' | PROGRAM '<command>' | stdin | stdout | pstdout | pstdout
*
* An undocumented fact is that you can still write BINARY before the
* tablename; this is a hangover from the pre-7.3 syntax. The options
@@ -203,7 +203,7 @@ parse_slash_copy(const char *args)
if (pg_strcasecmp(token, "program") == 0)
{
- int toklen;
+ int toklen;
token = strtokx(NULL, whitespace, NULL, "'",
0, false, false, pset.encoding);
@@ -211,8 +211,8 @@ parse_slash_copy(const char *args)
goto error;
/*
- * The shell command must be quoted. This isn't fool-proof, but catches
- * most quoting errors.
+ * The shell command must be quoted. This isn't fool-proof, but
+ * catches most quoting errors.
*/
toklen = strlen(token);
if (token[0] != '\'' || toklen < 2 || token[toklen - 1] != '\'')
@@ -381,7 +381,8 @@ do_copy(const char *args)
{
if (options->program)
{
- int pclose_rc = pclose(copystream);
+ int pclose_rc = pclose(copystream);
+
if (pclose_rc != 0)
{
if (pclose_rc < 0)
@@ -389,7 +390,8 @@ do_copy(const char *args)
strerror(errno));
else
{
- char *reason = wait_result_to_str(pclose_rc);
+ char *reason = wait_result_to_str(pclose_rc);
+
psql_error("%s: %s\n", options->file,
reason ? reason : "");
if (reason)
diff --git a/src/bin/psql/create_help.pl b/src/bin/psql/create_help.pl
index be23a23c41c..08fcc489518 100644
--- a/src/bin/psql/create_help.pl
+++ b/src/bin/psql/create_help.pl
@@ -202,8 +202,7 @@ print HFILE "
#define QL_HELP_COUNT "
- . scalar(keys %entries)
- . " /* number of help items */
+ . scalar(keys %entries) . " /* number of help items */
#define QL_MAX_CMD_LEN $maxlen /* largest strlen(cmd) */
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 4ce831a4335..9b6b9c2cd0a 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -135,7 +135,7 @@ describeTablespaces(const char *pattern, bool verbose)
if (pset.sversion < 80000)
{
psql_error("The server (version %d.%d) does not support tablespaces.\n",
- pset.sversion / 10000, (pset.sversion / 100) % 100);
+ pset.sversion / 10000, (pset.sversion / 100) % 100);
return true;
}
@@ -228,7 +228,7 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool
if (showWindow && pset.sversion < 80400)
{
psql_error("\\df does not take a \"w\" option with server version %d.%d\n",
- pset.sversion / 10000, (pset.sversion / 100) % 100);
+ pset.sversion / 10000, (pset.sversion / 100) % 100);
return true;
}
@@ -330,7 +330,7 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool
if (verbose)
appendPQExpBuffer(&buf,
- ",\n CASE WHEN prosecdef THEN '%s' ELSE '%s' END AS \"%s\""
+ ",\n CASE WHEN prosecdef THEN '%s' ELSE '%s' END AS \"%s\""
",\n CASE\n"
" WHEN p.provolatile = 'i' THEN '%s'\n"
" WHEN p.provolatile = 's' THEN '%s'\n"
@@ -807,7 +807,7 @@ listDefaultACLs(const char *pattern)
if (pset.sversion < 90000)
{
psql_error("The server (version %d.%d) does not support altering default privileges.\n",
- pset.sversion / 10000, (pset.sversion / 100) % 100);
+ pset.sversion / 10000, (pset.sversion / 100) % 100);
return true;
}
@@ -1078,7 +1078,7 @@ describeTableDetails(const char *pattern, bool verbose, bool showSystem)
{
if (!pset.quiet)
psql_error("Did not find any relation named \"%s\".\n",
- pattern);
+ pattern);
PQclear(res);
return false;
}
@@ -2565,7 +2565,7 @@ listDbRoleSettings(const char *pattern, const char *pattern2)
bool havewhere;
printfPQExpBuffer(&buf, "SELECT rolname AS \"%s\", datname AS \"%s\",\n"
- "pg_catalog.array_to_string(setconfig, E'\\n') AS \"%s\"\n"
+ "pg_catalog.array_to_string(setconfig, E'\\n') AS \"%s\"\n"
"FROM pg_db_role_setting AS s\n"
"LEFT JOIN pg_database ON pg_database.oid = setdatabase\n"
"LEFT JOIN pg_roles ON pg_roles.oid = setrole\n",
@@ -3020,7 +3020,7 @@ listEventTriggers(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] =
- {false, false, false, true, false, false, false};
+ {false, false, false, true, false, false, false};
initPQExpBuffer(&buf);
@@ -3034,7 +3034,7 @@ listEventTriggers(const char *pattern, bool verbose)
" when 'D' then 'disabled' end as \"%s\", "
"e.evtfoid::regproc as \"%s\", "
"array_to_string(array(select x "
- " from unnest(evttags) as t(x)), ', ') as \"%s\" ",
+ " from unnest(evttags) as t(x)), ', ') as \"%s\" ",
gettext_noop("Name"),
gettext_noop("Event"),
gettext_noop("Owner"),
@@ -3043,7 +3043,7 @@ listEventTriggers(const char *pattern, bool verbose)
gettext_noop("Tags"));
if (verbose)
appendPQExpBuffer(&buf,
- ",\npg_catalog.obj_description(e.oid, 'pg_event_trigger') as \"%s\"",
+ ",\npg_catalog.obj_description(e.oid, 'pg_event_trigger') as \"%s\"",
gettext_noop("Description"));
appendPQExpBuffer(&buf,
"\nFROM pg_event_trigger e ");
@@ -3183,7 +3183,7 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
if (pset.sversion < 90100)
{
psql_error("The server (version %d.%d) does not support collations.\n",
- pset.sversion / 10000, (pset.sversion / 100) % 100);
+ pset.sversion / 10000, (pset.sversion / 100) % 100);
return true;
}
@@ -3314,7 +3314,7 @@ listTSParsers(const char *pattern, bool verbose)
if (pset.sversion < 80300)
{
psql_error("The server (version %d.%d) does not support full text search.\n",
- pset.sversion / 10000, (pset.sversion / 100) % 100);
+ pset.sversion / 10000, (pset.sversion / 100) % 100);
return true;
}
@@ -3391,7 +3391,7 @@ listTSParsersVerbose(const char *pattern)
{
if (!pset.quiet)
psql_error("Did not find any text search parser named \"%s\".\n",
- pattern);
+ pattern);
PQclear(res);
return false;
}
@@ -3547,7 +3547,7 @@ listTSDictionaries(const char *pattern, bool verbose)
if (pset.sversion < 80300)
{
psql_error("The server (version %d.%d) does not support full text search.\n",
- pset.sversion / 10000, (pset.sversion / 100) % 100);
+ pset.sversion / 10000, (pset.sversion / 100) % 100);
return true;
}
@@ -3615,7 +3615,7 @@ listTSTemplates(const char *pattern, bool verbose)
if (pset.sversion < 80300)
{
psql_error("The server (version %d.%d) does not support full text search.\n",
- pset.sversion / 10000, (pset.sversion / 100) % 100);
+ pset.sversion / 10000, (pset.sversion / 100) % 100);
return true;
}
@@ -3683,7 +3683,7 @@ listTSConfigs(const char *pattern, bool verbose)
if (pset.sversion < 80300)
{
psql_error("The server (version %d.%d) does not support full text search.\n",
- pset.sversion / 10000, (pset.sversion / 100) % 100);
+ pset.sversion / 10000, (pset.sversion / 100) % 100);
return true;
}
@@ -3761,7 +3761,7 @@ listTSConfigsVerbose(const char *pattern)
{
if (!pset.quiet)
psql_error("Did not find any text search configuration named \"%s\".\n",
- pattern);
+ pattern);
PQclear(res);
return false;
}
@@ -3881,7 +3881,7 @@ listForeignDataWrappers(const char *pattern, bool verbose)
if (pset.sversion < 80400)
{
psql_error("The server (version %d.%d) does not support foreign-data wrappers.\n",
- pset.sversion / 10000, (pset.sversion / 100) % 100);
+ pset.sversion / 10000, (pset.sversion / 100) % 100);
return true;
}
@@ -3961,7 +3961,7 @@ listForeignServers(const char *pattern, bool verbose)
if (pset.sversion < 80400)
{
psql_error("The server (version %d.%d) does not support foreign servers.\n",
- pset.sversion / 10000, (pset.sversion / 100) % 100);
+ pset.sversion / 10000, (pset.sversion / 100) % 100);
return true;
}
@@ -4040,7 +4040,7 @@ listUserMappings(const char *pattern, bool verbose)
if (pset.sversion < 80400)
{
psql_error("The server (version %d.%d) does not support user mappings.\n",
- pset.sversion / 10000, (pset.sversion / 100) % 100);
+ pset.sversion / 10000, (pset.sversion / 100) % 100);
return true;
}
@@ -4098,7 +4098,7 @@ listForeignTables(const char *pattern, bool verbose)
if (pset.sversion < 90100)
{
psql_error("The server (version %d.%d) does not support foreign tables.\n",
- pset.sversion / 10000, (pset.sversion / 100) % 100);
+ pset.sversion / 10000, (pset.sversion / 100) % 100);
return true;
}
@@ -4172,7 +4172,7 @@ listExtensions(const char *pattern)
if (pset.sversion < 90100)
{
psql_error("The server (version %d.%d) does not support extensions.\n",
- pset.sversion / 10000, (pset.sversion / 100) % 100);
+ pset.sversion / 10000, (pset.sversion / 100) % 100);
return true;
}
@@ -4226,7 +4226,7 @@ listExtensionContents(const char *pattern)
if (pset.sversion < 90100)
{
psql_error("The server (version %d.%d) does not support extensions.\n",
- pset.sversion / 10000, (pset.sversion / 100) % 100);
+ pset.sversion / 10000, (pset.sversion / 100) % 100);
return true;
}
@@ -4253,7 +4253,7 @@ listExtensionContents(const char *pattern)
{
if (pattern)
psql_error("Did not find any extension named \"%s\".\n",
- pattern);
+ pattern);
else
psql_error("Did not find any extensions.\n");
}
diff --git a/src/bin/psql/print.c b/src/bin/psql/print.c
index 7e1f27ac9e2..5589ceaa7ff 100644
--- a/src/bin/psql/print.c
+++ b/src/bin/psql/print.c
@@ -1747,10 +1747,10 @@ print_latex_longtable_text(const printTableContent *cont, FILE *fout)
{
fputs("p{", fout);
fwrite(next_opt_table_attr_char, strcspn(next_opt_table_attr_char,
- LONGTABLE_WHITESPACE), 1, fout);
+ LONGTABLE_WHITESPACE), 1, fout);
last_opt_table_attr_char = next_opt_table_attr_char;
next_opt_table_attr_char += strcspn(next_opt_table_attr_char,
- LONGTABLE_WHITESPACE);
+ LONGTABLE_WHITESPACE);
fputs("\\textwidth}", fout);
}
/* use previous value */
@@ -1758,7 +1758,7 @@ print_latex_longtable_text(const printTableContent *cont, FILE *fout)
{
fputs("p{", fout);
fwrite(last_opt_table_attr_char, strcspn(last_opt_table_attr_char,
- LONGTABLE_WHITESPACE), 1, fout);
+ LONGTABLE_WHITESPACE), 1, fout);
fputs("\\textwidth}", fout);
}
else
diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c
index 5d7fe6ea27f..831e1b3ca6f 100644
--- a/src/bin/psql/startup.c
+++ b/src/bin/psql/startup.c
@@ -151,9 +151,9 @@ main(int argc, char *argv[])
parse_psql_options(argc, argv, &options);
/*
- * If no action was specified and we're in non-interactive mode, treat
- * it as if the user had specified "-f -". This lets single-transaction
- * mode work in this case.
+ * If no action was specified and we're in non-interactive mode, treat it
+ * as if the user had specified "-f -". This lets single-transaction mode
+ * work in this case.
*/
if (options.action == ACT_NOTHING && pset.notty)
{
@@ -165,9 +165,9 @@ main(int argc, char *argv[])
if (options.single_txn && options.action != ACT_FILE)
{
if (options.action == ACT_NOTHING)
- fprintf(stderr,_("%s: -1 can only be used in non-interactive mode\n"), pset.progname);
+ fprintf(stderr, _("%s: -1 can only be used in non-interactive mode\n"), pset.progname);
else
- fprintf(stderr,_("%s: -1 is incompatible with -c and -l\n"), pset.progname);
+ fprintf(stderr, _("%s: -1 is incompatible with -c and -l\n"), pset.progname);
exit(EXIT_FAILURE);
}
@@ -621,7 +621,7 @@ process_psqlrc(char *argv0)
if (envrc != NULL && strlen(envrc) > 0)
{
/* might need to free() this */
- char *envrc_alloc = pstrdup(envrc);
+ char *envrc_alloc = pstrdup(envrc);
expand_tilde(&envrc_alloc);
process_psqlrc_file(envrc_alloc);
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 7d2c8126126..8eb9f83b994 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -360,7 +360,7 @@ static const SchemaQuery Query_for_list_of_constraints_with_schema = {
/* selcondition */
"c.conrelid <> 0",
/* viscondition */
- "true", /* there is no pg_constraint_is_visible */
+ "true", /* there is no pg_constraint_is_visible */
/* namespace */
"c.connamespace",
/* result */
@@ -646,7 +646,7 @@ static const SchemaQuery Query_for_list_of_matviews = {
" and pg_catalog.pg_type_is_visible(t.oid)"
/* the silly-looking length condition is just to eat up the current word */
-#define Query_for_list_of_tables_for_constraint \
+#define Query_for_list_of_tables_for_constraint \
"SELECT pg_catalog.quote_ident(relname) "\
" FROM pg_catalog.pg_class"\
" WHERE (%d = pg_catalog.length('%s'))"\
@@ -1472,7 +1472,11 @@ psql_completion(char *text, int start, int end)
pg_strcasecmp(prev2_wd, "DROP") == 0 &&
pg_strcasecmp(prev_wd, "COLUMN") == 0)
COMPLETE_WITH_ATTR(prev3_wd, "");
- /* If we have ALTER TABLE <sth> DROP|RENAME|VALIDATE CONSTRAINT, provide list of constraints */
+
+ /*
+ * If we have ALTER TABLE <sth> DROP|RENAME|VALIDATE CONSTRAINT, provide
+ * list of constraints
+ */
else if (pg_strcasecmp(prev5_wd, "ALTER") == 0 &&
pg_strcasecmp(prev4_wd, "TABLE") == 0 &&
(pg_strcasecmp(prev2_wd, "DROP") == 0 ||
@@ -1832,7 +1836,7 @@ psql_completion(char *text, int start, int end)
* If we have CLUSTER VERBOSE <sth> USING, then add the index as well.
*/
else if (pg_strcasecmp(prev4_wd, "CLUSTER") == 0 &&
- pg_strcasecmp(prev3_wd, "VERBOSE") == 0 &&
+ pg_strcasecmp(prev3_wd, "VERBOSE") == 0 &&
pg_strcasecmp(prev_wd, "USING") == 0)
{
completion_info_charp = prev2_wd;
@@ -2934,7 +2938,7 @@ psql_completion(char *text, int start, int end)
static const char *const list_SECURITY_LABEL[] =
{"LANGUAGE", "SCHEMA", "SEQUENCE", "TABLE", "TYPE", "VIEW",
"MATERIALIZED VIEW", "COLUMN", "AGGREGATE", "FUNCTION", "DOMAIN",
- "LARGE OBJECT", NULL};
+ "LARGE OBJECT", NULL};
COMPLETE_WITH_LIST(list_SECURITY_LABEL);
}
diff --git a/src/bin/scripts/pg_isready.c b/src/bin/scripts/pg_isready.c
index 4ba257d06ed..89542db2300 100644
--- a/src/bin/scripts/pg_isready.c
+++ b/src/bin/scripts/pg_isready.c
@@ -12,15 +12,17 @@
#include "postgres_fe.h"
#include "common.h"
-#define DEFAULT_CONNECT_TIMEOUT "3"
+#define DEFAULT_CONNECT_TIMEOUT "3"
static void
-help(const char *progname);
+ help(const char *progname);
int
main(int argc, char **argv)
{
- int c,optindex,opt_index = 2;
+ int c,
+ optindex,
+ opt_index = 2;
const char *progname;
@@ -30,28 +32,29 @@ main(int argc, char **argv)
const char *pgdbname = NULL;
const char *connect_timeout = DEFAULT_CONNECT_TIMEOUT;
- const char *keywords[7] = { NULL };
- const char *values[7] = { NULL };
+ const char *keywords[7] = {NULL};
+ const char *values[7] = {NULL};
- bool quiet = false;
+ bool quiet = false;
- PGPing rv;
- PQconninfoOption *connect_options, *conn_opt_ptr;
+ PGPing rv;
+ PQconninfoOption *connect_options,
+ *conn_opt_ptr;
/*
- * We accept user and database as options to avoid
- * useless errors from connecting with invalid params
+ * We accept user and database as options to avoid useless errors from
+ * connecting with invalid params
*/
static struct option long_options[] = {
- {"dbname", required_argument, NULL, 'd'},
- {"host", required_argument, NULL, 'h'},
- {"port", required_argument, NULL, 'p'},
- {"quiet", no_argument, NULL, 'q'},
- {"timeout", required_argument, NULL, 't'},
- {"username", required_argument, NULL, 'U'},
- {NULL, 0, NULL, 0}
- };
+ {"dbname", required_argument, NULL, 'd'},
+ {"host", required_argument, NULL, 'h'},
+ {"port", required_argument, NULL, 'p'},
+ {"quiet", no_argument, NULL, 'q'},
+ {"timeout", required_argument, NULL, 't'},
+ {"username", required_argument, NULL, 'U'},
+ {NULL, 0, NULL, 0}
+ };
progname = get_progname(argv[0]);
set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pgscripts"));
@@ -81,6 +84,7 @@ main(int argc, char **argv)
break;
default:
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
+
/*
* We need to make sure we don't return 1 here because someone
* checking the return code might infer unintended meaning
@@ -94,6 +98,7 @@ main(int argc, char **argv)
fprintf(stderr, _("%s: too many command-line arguments (first is \"%s\")\n"),
progname, argv[optind]);
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
+
/*
* We need to make sure we don't return 1 here because someone
* checking the return code might infer unintended meaning