diff options
Diffstat (limited to 'src/bin')
62 files changed, 623 insertions, 479 deletions
diff --git a/src/bin/initdb/findtimezone.c b/src/bin/initdb/findtimezone.c index bc1f2c2c973..f0255d85af4 100644 --- a/src/bin/initdb/findtimezone.c +++ b/src/bin/initdb/findtimezone.c @@ -52,7 +52,7 @@ pg_TZDIR(void) * This is simpler than the backend function of the same name because * we assume that the input string has the correct case already, so there * is no need for case-folding. (This is obviously true if we got the file - * name from the filesystem to start with. The only other place it can come + * name from the filesystem to start with. The only other place it can come * from is the environment variable TZ, and there seems no need to allow * case variation in that; other programs aren't likely to.) * @@ -471,7 +471,7 @@ identify_system_timezone(void) return resultbuf; /* - * Did not find the timezone. Fallback to use a GMT zone. Note that the + * Did not find the timezone. Fallback to use a GMT zone. Note that the * Olson timezone database names the GMT-offset zones in POSIX style: plus * is west of Greenwich. It's unfortunate that this is opposite of SQL * conventions. Should we therefore change the names? Probably not... @@ -490,7 +490,7 @@ identify_system_timezone(void) * Recursively scan the timezone database looking for the best match to * the system timezone behavior. * - * tzdir points to a buffer of size MAXPGPATH. On entry, it holds the + * tzdir points to a buffer of size MAXPGPATH. On entry, it holds the * pathname of a directory containing TZ files. We internally modify it * to hold pathnames of sub-directories and files, but must restore it * to its original contents before exit. diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index 83b7f6e24d8..2a51916106b 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -18,7 +18,7 @@ * to produce a new database. * * For largely-historical reasons, the template1 database is the one built - * by the basic bootstrap process. After it is complete, template0 and + * by the basic bootstrap process. After it is complete, template0 and * the default database, postgres, are made just by copying template1. * * To create template1, we run the postgres (backend) program in bootstrap @@ -581,7 +581,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); @@ -614,7 +614,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) @@ -772,7 +772,7 @@ exit_nicely(void) static char * get_id(void) { - const char *username; + const char *username; #ifndef WIN32 if (geteuid() == 0) /* 0 is root's uid */ @@ -1057,13 +1057,13 @@ static char * choose_dsm_implementation(void) { #ifdef HAVE_SHM_OPEN - int ntries = 10; + int ntries = 10; while (ntries > 0) { - uint32 handle; - char name[64]; - int fd; + uint32 handle; + char name[64]; + int fd; handle = random(); snprintf(name, 64, "/PostgreSQL.%u", handle); @@ -1976,7 +1976,7 @@ setup_collation(void) */ if (normalize_locale_name(alias, localebuf)) { - char *quoted_alias = escape_quotes(alias); + char *quoted_alias = escape_quotes(alias); PG_CMD_PRINTF3("INSERT INTO tmp_pg_collation VALUES (E'%s', E'%s', %d);\n", quoted_alias, quoted_locale, enc); @@ -1992,7 +1992,7 @@ setup_collation(void) * When copying collations to the final location, eliminate aliases that * conflict with an existing locale name for the same encoding. For * example, "br_FR.iso88591" is normalized to "br_FR", both for encoding - * LATIN1. But the unnormalized locale "br_FR" already exists for LATIN1. + * LATIN1. But the unnormalized locale "br_FR" already exists for LATIN1. * Prefer the alias that matches the OS locale name, else the first locale * name by sort order (arbitrary choice to be deterministic). * @@ -2099,7 +2099,7 @@ setup_dictionary(void) /* * Set up privileges * - * We mark most system catalogs as world-readable. We don't currently have + * We mark most system catalogs as world-readable. We don't currently have * to touch functions, languages, or databases, because their default * permissions are OK. * @@ -2532,7 +2532,7 @@ locale_date_order(const char *locale) * Is the locale name valid for the locale category? * * If successful, and canonname isn't NULL, a malloc'd copy of the locale's - * canonical name is stored there. This is especially useful for figuring out + * canonical name is stored there. This is especially useful for figuring out * what locale name "" means (ie, the environment value). (Actually, * it seems that on most implementations that's the only thing it's good for; * we could wish that setlocale gave back a canonically spelled version of @@ -2886,6 +2886,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. diff --git a/src/bin/initdb/t/001_initdb.pl b/src/bin/initdb/t/001_initdb.pl index ad6d74cc0dd..a7bea76f529 100644 --- a/src/bin/initdb/t/001_initdb.pl +++ b/src/bin/initdb/t/001_initdb.pl @@ -9,29 +9,36 @@ program_help_ok('initdb'); program_version_ok('initdb'); program_options_handling_ok('initdb'); -command_ok(['initdb', "$tempdir/data"], 'basic initdb'); -command_fails(['initdb', "$tempdir/data"], 'existing data directory'); -command_ok(['initdb', '-N', "$tempdir/data2"], 'nosync'); -command_ok(['initdb', '-S', "$tempdir/data2"], 'sync only'); -command_fails(['initdb', '-S', "$tempdir/data3"], 'sync missing data directory'); +command_ok([ 'initdb', "$tempdir/data" ], 'basic initdb'); +command_fails([ 'initdb', "$tempdir/data" ], 'existing data directory'); +command_ok([ 'initdb', '-N', "$tempdir/data2" ], 'nosync'); +command_ok([ 'initdb', '-S', "$tempdir/data2" ], 'sync only'); +command_fails([ 'initdb', '-S', "$tempdir/data3" ], + 'sync missing data directory'); mkdir "$tempdir/data4" or BAIL_OUT($!); -command_ok(['initdb', "$tempdir/data4"], 'existing empty data directory'); +command_ok([ 'initdb', "$tempdir/data4" ], 'existing empty data directory'); system_or_bail "rm -rf $tempdir/*"; -command_ok(['initdb', "$tempdir/data", '-X', "$tempdir/pgxlog"], 'separate xlog directory'); +command_ok([ 'initdb', "$tempdir/data", '-X', "$tempdir/pgxlog" ], + 'separate xlog directory'); system_or_bail "rm -rf $tempdir/*"; -command_fails(['initdb', "$tempdir/data", '-X', 'pgxlog'], 'relative xlog directory not allowed'); +command_fails( + [ 'initdb', "$tempdir/data", '-X', 'pgxlog' ], + 'relative xlog directory not allowed'); system_or_bail "rm -rf $tempdir/*"; mkdir "$tempdir/pgxlog"; -command_ok(['initdb', "$tempdir/data", '-X', "$tempdir/pgxlog"], 'existing empty xlog directory'); +command_ok([ 'initdb', "$tempdir/data", '-X', "$tempdir/pgxlog" ], + 'existing empty xlog directory'); system_or_bail "rm -rf $tempdir/*"; mkdir "$tempdir/pgxlog"; mkdir "$tempdir/pgxlog/lost+found"; -command_fails(['initdb', "$tempdir/data", '-X', "$tempdir/pgxlog"], 'existing nonempty xlog directory'); +command_fails([ 'initdb', "$tempdir/data", '-X', "$tempdir/pgxlog" ], + 'existing nonempty xlog directory'); system_or_bail "rm -rf $tempdir/*"; -command_ok(['initdb', "$tempdir/data", '-T', 'german'], 'select default dictionary'); +command_ok([ 'initdb', "$tempdir/data", '-T', 'german' ], + 'select default dictionary'); diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.c index 1a468fa1b74..154c52d1909 100644 --- a/src/bin/pg_basebackup/pg_basebackup.c +++ b/src/bin/pg_basebackup/pg_basebackup.c @@ -40,8 +40,8 @@ typedef struct TablespaceListCell { struct TablespaceListCell *next; - char old_dir[MAXPGPATH]; - char new_dir[MAXPGPATH]; + char old_dir[MAXPGPATH]; + char new_dir[MAXPGPATH]; } TablespaceListCell; typedef struct TablespaceList @@ -54,15 +54,15 @@ typedef struct TablespaceList static char *basedir = NULL; static TablespaceList tablespace_dirs = {NULL, NULL}; static char *xlog_dir = ""; -static char format = 'p'; /* p(lain)/t(ar) */ +static char format = 'p'; /* p(lain)/t(ar) */ static char *label = "pg_basebackup base backup"; -static bool showprogress = false; -static int verbose = 0; +static bool showprogress = false; +static int verbose = 0; static int compresslevel = 0; -static bool includewal = false; -static bool streamwal = false; -static bool fastcheckpoint = false; -static bool writerecoveryconf = false; +static bool includewal = false; +static bool streamwal = false; +static bool fastcheckpoint = false; +static bool writerecoveryconf = false; static int standby_message_timeout = 10 * 1000; /* 10 sec = default */ static pg_time_t last_progress_report = 0; static int32 maxrate = 0; /* no limit by default */ @@ -113,18 +113,20 @@ static void update_tablespace_symlink(Oid oid, const char *old_dir); static void tablespace_list_append(const char *arg); -static void disconnect_and_exit(int code) +static void +disconnect_and_exit(int code) { if (conn != NULL) PQfinish(conn); #ifndef WIN32 + /* - * On windows, our background thread dies along with the process. - * But on Unix, if we have started a subprocess, we want to kill - * it off so it doesn't remain running trying to stream data. + * On windows, our background thread dies along with the process. But on + * Unix, if we have started a subprocess, we want to kill it off so it + * doesn't remain running trying to stream data. */ - if (bgchild> 0) + if (bgchild > 0) kill(bgchild, SIGTERM); #endif @@ -140,21 +142,21 @@ static void tablespace_list_append(const char *arg) { TablespaceListCell *cell = (TablespaceListCell *) pg_malloc0(sizeof(TablespaceListCell)); - char *dst; - char *dst_ptr; - const char *arg_ptr; + char *dst; + char *dst_ptr; + const char *arg_ptr; dst_ptr = dst = cell->old_dir; for (arg_ptr = arg; *arg_ptr; arg_ptr++) { if (dst_ptr - dst >= MAXPGPATH) { - fprintf(stderr, _("%s: directory name too long\n"), progname); + fprintf(stderr, _("%s: directory name too long\n"), progname); exit(1); } if (*arg_ptr == '\\' && *(arg_ptr + 1) == '=') - ; /* skip backslash escaping = */ + ; /* skip backslash escaping = */ else if (*arg_ptr == '=' && (arg_ptr == arg || *(arg_ptr - 1) != '\\')) { if (*cell->new_dir) @@ -177,10 +179,12 @@ tablespace_list_append(const char *arg) exit(1); } - /* This check isn't absolutely necessary. But all tablespaces are created + /* + * This check isn't absolutely necessary. But all tablespaces are created * with absolute directories, so specifying a non-absolute path here would * just never match, possibly confusing users. It's also good to be - * consistent with the new_dir check. */ + * consistent with the new_dir check. + */ if (!is_absolute_path(cell->old_dir)) { fprintf(stderr, _("%s: old directory not absolute in tablespace mapping: %s\n"), @@ -232,7 +236,7 @@ usage(void) printf(_(" -R, --write-recovery-conf\n" " write recovery.conf after backup\n")); printf(_(" -T, --tablespace-mapping=OLDDIR=NEWDIR\n" - " relocate tablespace in OLDDIR to NEWDIR\n")); + " relocate tablespace in OLDDIR to NEWDIR\n")); printf(_(" -x, --xlog include required WAL files in backup (fetch mode)\n")); printf(_(" -X, --xlog-method=fetch|stream\n" " include required WAL files with specified method\n")); @@ -296,7 +300,7 @@ reached_end_position(XLogRecPtr segendpos, uint32 timeline, lo; MemSet(xlogend, 0, sizeof(xlogend)); - r = read(bgpipe[0], xlogend, sizeof(xlogend)-1); + r = read(bgpipe[0], xlogend, sizeof(xlogend) - 1); if (r < 0) { fprintf(stderr, _("%s: could not read from ready pipe: %s\n"), @@ -536,7 +540,7 @@ progress_report(int tablespacenum, const char *filename, bool force) now = time(NULL); if (now == last_progress_report && !force) - return; /* Max once per second */ + return; /* Max once per second */ last_progress_report = now; percent = totalsize ? (int) ((totaldone / 1024) * 100 / totalsize) : 0; @@ -614,7 +618,7 @@ parse_max_rate(char *src) { double result; char *after_num; - char *suffix = NULL; + char *suffix = NULL; errno = 0; result = strtod(src, &after_num); @@ -644,8 +648,8 @@ parse_max_rate(char *src) } /* - * Evaluate suffix, after skipping over possible whitespace. - * Lack of suffix means kilobytes. + * Evaluate suffix, after skipping over possible whitespace. Lack of + * suffix means kilobytes. */ while (*after_num != '\0' && isspace((unsigned char) *after_num)) after_num++; @@ -681,8 +685,8 @@ parse_max_rate(char *src) if ((uint64) result != (uint64) ((uint32) result)) { fprintf(stderr, - _("%s: transfer rate \"%s\" exceeds integer range\n"), - progname, src); + _("%s: transfer rate \"%s\" exceeds integer range\n"), + progname, src); exit(1); } @@ -1114,7 +1118,7 @@ update_tablespace_symlink(Oid oid, const char *old_dir) if (strcmp(old_dir, new_dir) != 0) { - char *linkloc = psprintf("%s/pg_tblspc/%d", basedir, oid); + char *linkloc = psprintf("%s/pg_tblspc/%d", basedir, oid); if (unlink(linkloc) != 0 && errno != ENOENT) { @@ -1742,7 +1746,8 @@ BaseBackup(void) */ if (format == 'p' && !PQgetisnull(res, i, 1)) { - char *path = (char *) get_tablespace_mapping(PQgetvalue(res, i, 1)); + char *path = (char *) get_tablespace_mapping(PQgetvalue(res, i, 1)); + verify_dir_is_empty_or_create(path); } } @@ -1791,7 +1796,8 @@ BaseBackup(void) { for (i = 0; i < PQntuples(res); i++) { - Oid tblspc_oid = atooid(PQgetvalue(res, i, 0)); + Oid tblspc_oid = atooid(PQgetvalue(res, i, 0)); + if (tblspc_oid) update_tablespace_symlink(tblspc_oid, PQgetvalue(res, i, 1)); } diff --git a/src/bin/pg_basebackup/pg_receivexlog.c b/src/bin/pg_basebackup/pg_receivexlog.c index 406610a8625..96408389062 100644 --- a/src/bin/pg_basebackup/pg_receivexlog.c +++ b/src/bin/pg_basebackup/pg_receivexlog.c @@ -228,9 +228,9 @@ FindStreamingStart(uint32 *tli) XLogRecPtr high_ptr; /* - * Move the starting pointer to the start of the next segment, if - * the highest one we saw was completed. Otherwise start streaming - * from the beginning of the .partial segment. + * Move the starting pointer to the start of the next segment, if the + * highest one we saw was completed. Otherwise start streaming from + * the beginning of the .partial segment. */ if (!high_ispartial) high_segno++; diff --git a/src/bin/pg_basebackup/pg_recvlogical.c b/src/bin/pg_basebackup/pg_recvlogical.c index fe902cf9691..194d10faa5c 100644 --- a/src/bin/pg_basebackup/pg_recvlogical.c +++ b/src/bin/pg_basebackup/pg_recvlogical.c @@ -31,27 +31,27 @@ #define RECONNECT_SLEEP_TIME 5 /* Global Options */ -static char *outfile = NULL; -static int verbose = 0; -static int noloop = 0; -static int standby_message_timeout = 10 * 1000; /* 10 sec = default */ -static int fsync_interval = 10 * 1000; /* 10 sec = default */ +static char *outfile = NULL; +static int verbose = 0; +static int noloop = 0; +static int standby_message_timeout = 10 * 1000; /* 10 sec = default */ +static int fsync_interval = 10 * 1000; /* 10 sec = default */ static XLogRecPtr startpos = InvalidXLogRecPtr; -static bool do_create_slot = false; -static bool do_start_slot = false; -static bool do_drop_slot = false; +static bool do_create_slot = false; +static bool do_start_slot = false; +static bool do_drop_slot = false; /* filled pairwise with option, value. value may be NULL */ -static char **options; -static size_t noptions = 0; +static char **options; +static size_t noptions = 0; static const char *plugin = "test_decoding"; /* Global State */ -static int outfd = -1; +static int outfd = -1; static volatile sig_atomic_t time_to_abort = false; static volatile sig_atomic_t output_reopen = false; -static int64 output_last_fsync = -1; -static bool output_unsynced = false; +static int64 output_last_fsync = -1; +static bool output_unsynced = false; static XLogRecPtr output_written_lsn = InvalidXLogRecPtr; static XLogRecPtr output_fsync_lsn = InvalidXLogRecPtr; @@ -111,8 +111,8 @@ sendFeedback(PGconn *conn, int64 now, bool force, bool replyRequested) /* * we normally don't want to send superfluous feedbacks, but if it's - * because of a timeout we need to, otherwise wal_sender_timeout will - * kill us. + * because of a timeout we need to, otherwise wal_sender_timeout will kill + * us. */ if (!force && last_written_lsn == output_written_lsn && @@ -121,21 +121,21 @@ sendFeedback(PGconn *conn, int64 now, bool force, bool replyRequested) if (verbose) fprintf(stderr, - _("%s: confirming write up to %X/%X, flush to %X/%X (slot %s)\n"), + _("%s: confirming write up to %X/%X, flush to %X/%X (slot %s)\n"), progname, - (uint32) (output_written_lsn >> 32), (uint32) output_written_lsn, + (uint32) (output_written_lsn >> 32), (uint32) output_written_lsn, (uint32) (output_fsync_lsn >> 32), (uint32) output_fsync_lsn, replication_slot); replybuf[len] = 'r'; len += 1; - fe_sendint64(output_written_lsn, &replybuf[len]); /* write */ + fe_sendint64(output_written_lsn, &replybuf[len]); /* write */ len += 8; fe_sendint64(output_fsync_lsn, &replybuf[len]); /* flush */ len += 8; - fe_sendint64(InvalidXLogRecPtr, &replybuf[len]); /* apply */ + fe_sendint64(InvalidXLogRecPtr, &replybuf[len]); /* apply */ len += 8; - fe_sendint64(now, &replybuf[len]); /* sendTime */ + fe_sendint64(now, &replybuf[len]); /* sendTime */ len += 8; replybuf[len] = replyRequested ? 1 : 0; /* replyRequested */ len += 1; @@ -227,7 +227,7 @@ StreamLog(void) /* Initiate the replication stream at specified location */ appendPQExpBuffer(query, "START_REPLICATION SLOT \"%s\" LOGICAL %X/%X", - replication_slot, (uint32) (startpos >> 32), (uint32) startpos); + replication_slot, (uint32) (startpos >> 32), (uint32) startpos); /* print options if there are any */ if (noptions) @@ -549,7 +549,7 @@ StreamLog(void) if (outfd != -1 && strcmp(outfile, "-") != 0) { - int64 t = feGetCurrentTimestamp(); + int64 t = feGetCurrentTimestamp(); /* no need to jump to error on failure here, we're finishing anyway */ OutputFsync(t); @@ -693,8 +693,8 @@ main(int argc, char **argv) /* replication options */ case 'o': { - char *data = pg_strdup(optarg); - char *val = strchr(data, '='); + char *data = pg_strdup(optarg); + char *val = strchr(data, '='); if (val != NULL) { @@ -704,7 +704,7 @@ main(int argc, char **argv) } noptions += 1; - options = pg_realloc(options, sizeof(char*) * noptions * 2); + options = pg_realloc(options, sizeof(char *) * noptions * 2); options[(noptions - 1) * 2] = data; options[(noptions - 1) * 2 + 1] = val; diff --git a/src/bin/pg_basebackup/receivelog.c b/src/bin/pg_basebackup/receivelog.c index 2bf04484647..33d2911a0e0 100644 --- a/src/bin/pg_basebackup/receivelog.c +++ b/src/bin/pg_basebackup/receivelog.c @@ -328,9 +328,9 @@ sendFeedback(PGconn *conn, XLogRecPtr blockpos, int64 now, bool replyRequested) else fe_sendint64(InvalidXLogRecPtr, &replybuf[len]); /* flush */ len += 8; - fe_sendint64(InvalidXLogRecPtr, &replybuf[len]); /* apply */ + fe_sendint64(InvalidXLogRecPtr, &replybuf[len]); /* apply */ len += 8; - fe_sendint64(now, &replybuf[len]); /* sendTime */ + fe_sendint64(now, &replybuf[len]); /* sendTime */ len += 8; replybuf[len] = replyRequested ? 1 : 0; /* replyRequested */ len += 1; @@ -437,8 +437,8 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline, * reporting the flush position makes one eligible as a synchronous * replica. People shouldn't include generic names in * synchronous_standby_names, but we've protected them against it so - * far, so let's continue to do so in the situations when possible. - * If they've got a slot, though, we need to report the flush position, + * far, so let's continue to do so in the situations when possible. If + * they've got a slot, though, we need to report the flush position, * so that the master can remove WAL. */ reportFlushPosition = true; @@ -766,7 +766,7 @@ HandleCopyStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline, now = feGetCurrentTimestamp(); if (still_sending && standby_message_timeout > 0 && feTimestampDifferenceExceeds(last_status, now, - standby_message_timeout)) + standby_message_timeout)) { /* Time to send feedback! */ if (!sendFeedback(conn, blockpos, now, false)) diff --git a/src/bin/pg_basebackup/streamutil.c b/src/bin/pg_basebackup/streamutil.c index e440dc4e244..1100260c05a 100644 --- a/src/bin/pg_basebackup/streamutil.c +++ b/src/bin/pg_basebackup/streamutil.c @@ -255,7 +255,7 @@ feGetCurrentTimestamp(void) */ void feTimestampDifference(int64 start_time, int64 stop_time, - long *secs, int *microsecs) + long *secs, int *microsecs) { int64 diff = stop_time - start_time; @@ -277,8 +277,8 @@ feTimestampDifference(int64 start_time, int64 stop_time, */ bool feTimestampDifferenceExceeds(int64 start_time, - int64 stop_time, - int msec) + int64 stop_time, + int msec) { int64 diff = stop_time - start_time; diff --git a/src/bin/pg_basebackup/streamutil.h b/src/bin/pg_basebackup/streamutil.h index d0f3799d1e3..c36a37bf155 100644 --- a/src/bin/pg_basebackup/streamutil.h +++ b/src/bin/pg_basebackup/streamutil.h @@ -16,9 +16,9 @@ extern PGconn *GetConnection(void); extern int64 feGetCurrentTimestamp(void); extern void feTimestampDifference(int64 start_time, int64 stop_time, - long *secs, int *microsecs); + long *secs, int *microsecs); extern bool feTimestampDifferenceExceeds(int64 start_time, int64 stop_time, - int msec); + int msec); extern void fe_sendint64(int64 i, char *buf); extern int64 fe_recvint64(char *buf); diff --git a/src/bin/pg_basebackup/t/010_pg_basebackup.pl b/src/bin/pg_basebackup/t/010_pg_basebackup.pl index 38f46929558..597fb60a528 100644 --- a/src/bin/pg_basebackup/t/010_pg_basebackup.pl +++ b/src/bin/pg_basebackup/t/010_pg_basebackup.pl @@ -11,8 +11,11 @@ program_options_handling_ok('pg_basebackup'); my $tempdir = tempdir; start_test_server $tempdir; -command_fails(['pg_basebackup'], 'pg_basebackup needs target directory specified'); -command_fails(['pg_basebackup', '-D', "$tempdir/backup"], 'pg_basebackup fails because of hba'); +command_fails(['pg_basebackup'], + 'pg_basebackup needs target directory specified'); +command_fails( + [ 'pg_basebackup', '-D', "$tempdir/backup" ], + 'pg_basebackup fails because of hba'); open HBA, ">>$tempdir/pgdata/pg_hba.conf"; print HBA "local replication all trust\n"; @@ -21,7 +24,9 @@ print HBA "host replication all ::1/128 trust\n"; close HBA; system_or_bail 'pg_ctl', '-s', '-D', "$tempdir/pgdata", 'reload'; -command_fails(['pg_basebackup', '-D', "$tempdir/backup"], 'pg_basebackup fails because of WAL configuration'); +command_fails( + [ 'pg_basebackup', '-D', "$tempdir/backup" ], + 'pg_basebackup fails because of WAL configuration'); open CONF, ">>$tempdir/pgdata/postgresql.conf"; print CONF "max_wal_senders = 10\n"; @@ -29,62 +34,79 @@ print CONF "wal_level = archive\n"; close CONF; restart_test_server; -command_ok(['pg_basebackup', '-D', "$tempdir/backup"], 'pg_basebackup runs'); +command_ok([ 'pg_basebackup', '-D', "$tempdir/backup" ], + 'pg_basebackup runs'); ok(-f "$tempdir/backup/PG_VERSION", 'backup was created'); -command_ok(['pg_basebackup', '-D', "$tempdir/backup2", '--xlogdir', "$tempdir/xlog2"], 'separate xlog directory'); +command_ok( + [ 'pg_basebackup', '-D', "$tempdir/backup2", '--xlogdir', + "$tempdir/xlog2" ], + 'separate xlog directory'); ok(-f "$tempdir/backup2/PG_VERSION", 'backup was created'); -ok(-d "$tempdir/xlog2/", 'xlog directory was created'); +ok(-d "$tempdir/xlog2/", 'xlog directory was created'); -command_ok(['pg_basebackup', '-D', "$tempdir/tarbackup", '-Ft'], 'tar format'); +command_ok([ 'pg_basebackup', '-D', "$tempdir/tarbackup", '-Ft' ], + 'tar format'); ok(-f "$tempdir/tarbackup/base.tar", 'backup tar was created'); mkdir "$tempdir/tblspc1"; psql 'postgres', "CREATE TABLESPACE tblspc1 LOCATION '$tempdir/tblspc1';"; psql 'postgres', "CREATE TABLE test1 (a int) TABLESPACE tblspc1;"; -command_ok(['pg_basebackup', '-D', "$tempdir/tarbackup2", '-Ft'], 'tar format with tablespaces'); +command_ok([ 'pg_basebackup', '-D', "$tempdir/tarbackup2", '-Ft' ], + 'tar format with tablespaces'); ok(-f "$tempdir/tarbackup2/base.tar", 'backup tar was created'); my @tblspc_tars = glob "$tempdir/tarbackup2/[0-9]*.tar"; is(scalar(@tblspc_tars), 1, 'one tablespace tar was created'); -command_fails(['pg_basebackup', '-D', "$tempdir/backup1", '-Fp'], - 'plain format with tablespaces fails without tablespace mapping'); +command_fails( + [ 'pg_basebackup', '-D', "$tempdir/backup1", '-Fp' ], + 'plain format with tablespaces fails without tablespace mapping'); -command_ok(['pg_basebackup', '-D', "$tempdir/backup1", '-Fp', - "-T$tempdir/tblspc1=$tempdir/tbackup/tblspc1"], - 'plain format with tablespaces succeeds with tablespace mapping'); +command_ok( + [ 'pg_basebackup', '-D', + "$tempdir/backup1", '-Fp', + "-T$tempdir/tblspc1=$tempdir/tbackup/tblspc1" ], + 'plain format with tablespaces succeeds with tablespace mapping'); ok(-d "$tempdir/tbackup/tblspc1", 'tablespace was relocated'); opendir(my $dh, "$tempdir/pgdata/pg_tblspc") or die; -ok((grep { -l "$tempdir/backup1/pg_tblspc/$_" and readlink "$tempdir/backup1/pg_tblspc/$_" eq "$tempdir/tbackup/tblspc1" } readdir($dh)), - "tablespace symlink was updated"); +ok( ( grep + { + -l "$tempdir/backup1/pg_tblspc/$_" + and readlink "$tempdir/backup1/pg_tblspc/$_" eq + "$tempdir/tbackup/tblspc1" + } readdir($dh)), + "tablespace symlink was updated"); closedir $dh; mkdir "$tempdir/tbl=spc2"; psql 'postgres', "DROP TABLE test1;"; psql 'postgres', "DROP TABLESPACE tblspc1;"; psql 'postgres', "CREATE TABLESPACE tblspc2 LOCATION '$tempdir/tbl=spc2';"; -command_ok(['pg_basebackup', '-D', "$tempdir/backup3", '-Fp', - "-T$tempdir/tbl\\=spc2=$tempdir/tbackup/tbl\\=spc2"], - 'mapping tablespace with = sign in path'); +command_ok( + [ 'pg_basebackup', '-D', + "$tempdir/backup3", '-Fp', + "-T$tempdir/tbl\\=spc2=$tempdir/tbackup/tbl\\=spc2" ], + 'mapping tablespace with = sign in path'); ok(-d "$tempdir/tbackup/tbl=spc2", 'tablespace with = sign was relocated'); psql 'postgres', "DROP TABLESPACE tblspc2;"; -command_fails(['pg_basebackup', '-D', "$tempdir/backup_foo", '-Fp', - "-T=/foo"], - '-T with empty old directory fails'); -command_fails(['pg_basebackup', '-D', "$tempdir/backup_foo", '-Fp', - "-T/foo="], - '-T with empty new directory fails'); -command_fails(['pg_basebackup', '-D', "$tempdir/backup_foo", '-Fp', - "-T/foo=/bar=/baz"], - '-T with multiple = fails'); -command_fails(['pg_basebackup', '-D', "$tempdir/backup_foo", '-Fp', - "-Tfoo=/bar"], - '-T with old directory not absolute fails'); -command_fails(['pg_basebackup', '-D', "$tempdir/backup_foo", '-Fp', - "-T/foo=bar"], - '-T with new directory not absolute fails'); -command_fails(['pg_basebackup', '-D', "$tempdir/backup_foo", '-Fp', - "-Tfoo"], - '-T with invalid format fails'); +command_fails( + [ 'pg_basebackup', '-D', "$tempdir/backup_foo", '-Fp', "-T=/foo" ], + '-T with empty old directory fails'); +command_fails( + [ 'pg_basebackup', '-D', "$tempdir/backup_foo", '-Fp', "-T/foo=" ], + '-T with empty new directory fails'); +command_fails( + [ 'pg_basebackup', '-D', "$tempdir/backup_foo", '-Fp', + "-T/foo=/bar=/baz" ], + '-T with multiple = fails'); +command_fails( + [ 'pg_basebackup', '-D', "$tempdir/backup_foo", '-Fp', "-Tfoo=/bar" ], + '-T with old directory not absolute fails'); +command_fails( + [ 'pg_basebackup', '-D', "$tempdir/backup_foo", '-Fp', "-T/foo=bar" ], + '-T with new directory not absolute fails'); +command_fails( + [ 'pg_basebackup', '-D', "$tempdir/backup_foo", '-Fp', "-Tfoo" ], + '-T with invalid format fails'); diff --git a/src/bin/pg_config/t/001_pg_config.pl b/src/bin/pg_config/t/001_pg_config.pl index 200f394fd75..c911798dbc4 100644 --- a/src/bin/pg_config/t/001_pg_config.pl +++ b/src/bin/pg_config/t/001_pg_config.pl @@ -6,7 +6,11 @@ use Test::More tests => 7; program_help_ok('pg_config'); program_version_ok('pg_config'); program_options_handling_ok('pg_config'); -command_like(['pg_config', '--bindir'], qr/bin/, 'pg_config single option'); # XXX might be wrong -command_like(['pg_config', '--bindir', '--libdir'], qr/bin.*\n.*lib/, 'pg_config two options'); -command_like(['pg_config', '--libdir', '--bindir'], qr/lib.*\n.*bin/, 'pg_config two options different order'); -command_like(['pg_config'], qr/.*\n.*\n.*/, 'pg_config without options prints many lines'); +command_like([ 'pg_config', '--bindir' ], qr/bin/, 'pg_config single option') + ; # XXX might be wrong +command_like([ 'pg_config', '--bindir', '--libdir' ], + qr/bin.*\n.*lib/, 'pg_config two options'); +command_like([ 'pg_config', '--libdir', '--bindir' ], + qr/lib.*\n.*bin/, 'pg_config two options different order'); +command_like(['pg_config'], qr/.*\n.*\n.*/, + 'pg_config without options prints many lines'); diff --git a/src/bin/pg_controldata/pg_controldata.c b/src/bin/pg_controldata/pg_controldata.c index ea96fe14617..24e211668d1 100644 --- a/src/bin/pg_controldata/pg_controldata.c +++ b/src/bin/pg_controldata/pg_controldata.c @@ -12,7 +12,7 @@ /* * We have to use postgres.h not postgres_fe.h here, because there's so much * backend-only stuff in the XLOG include files we need. But we need a - * frontend-ish environment otherwise. Hence this ugly hack. + * frontend-ish environment otherwise. Hence this ugly hack. */ #define FRONTEND 1 diff --git a/src/bin/pg_controldata/t/001_pg_controldata.pl b/src/bin/pg_controldata/t/001_pg_controldata.pl index ca89d87535e..84c2fb25f36 100644 --- a/src/bin/pg_controldata/t/001_pg_controldata.pl +++ b/src/bin/pg_controldata/t/001_pg_controldata.pl @@ -9,6 +9,8 @@ program_help_ok('pg_controldata'); program_version_ok('pg_controldata'); program_options_handling_ok('pg_controldata'); command_fails(['pg_controldata'], 'pg_controldata without arguments fails'); -command_fails(['pg_controldata', 'nonexistent'], 'pg_controldata with nonexistent directory fails'); +command_fails([ 'pg_controldata', 'nonexistent' ], + 'pg_controldata with nonexistent directory fails'); system_or_bail "initdb -D $tempdir/data -A trust >/dev/null"; -command_like(['pg_controldata', "$tempdir/data"], qr/checkpoint/, 'pg_controldata produces output'); +command_like([ 'pg_controldata', "$tempdir/data" ], + qr/checkpoint/, 'pg_controldata produces output'); diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c index 473d6534064..d45a5262af7 100644 --- a/src/bin/pg_ctl/pg_ctl.c +++ b/src/bin/pg_ctl/pg_ctl.c @@ -257,14 +257,16 @@ get_pgpid(bool is_status_request) { if (errno == ENOENT) printf(_("%s: directory \"%s\" does not exist\n"), progname, - pg_data); + pg_data); else printf(_("%s: cannot access directory \"%s\"\n"), progname, - pg_data); + pg_data); + /* - * The Linux Standard Base Core Specification 3.1 says this should return - * '4, program or service status is unknown' - * https://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html + * The Linux Standard Base Core Specification 3.1 says this should + * return '4, program or service status is unknown' + * https://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-g + * eneric/iniscrptact.html */ exit(is_status_request ? 4 : 1); } @@ -272,7 +274,7 @@ get_pgpid(bool is_status_request) if (stat(version_file, &statbuf) != 0 && errno == ENOENT) { printf(_("%s: directory \"%s\" is not a database cluster directory\n"), - progname, pg_data); + progname, pg_data); exit(is_status_request ? 4 : 1); } @@ -401,8 +403,8 @@ readfile(const char *path) void free_readfile(char **optlines) { - char *curr_line = NULL; - int i = 0; + char *curr_line = NULL; + int i = 0; if (!optlines) return; @@ -506,7 +508,7 @@ test_postmaster_connection(bool do_checkpoint) * 6 9.1+ server, shared memory not created * 7 9.1+ server, shared memory created * - * This code does not support pre-9.1 servers. On Unix machines + * This code does not support pre-9.1 servers. On Unix machines * we could consider extracting the port number from the shmem * key, but that (a) is not robust, and (b) doesn't help with * finding out the socket directory. And it wouldn't work anyway @@ -539,7 +541,7 @@ test_postmaster_connection(bool do_checkpoint) time_t pmstart; /* - * Make sanity checks. If it's for a standalone backend + * Make sanity checks. If it's for a standalone backend * (negative PID), or the recorded start time is before * pg_ctl started, then either we are looking at the wrong * data directory, or this is a pre-existing pidfile that @@ -660,7 +662,7 @@ test_postmaster_connection(bool do_checkpoint) /* * If we've been able to identify the child postmaster's PID, check - * the process is still alive. This covers cases where the postmaster + * the process is still alive. This covers cases where the postmaster * successfully created the pidfile but then crashed without removing * it. */ @@ -755,7 +757,7 @@ read_post_opts(void) { *arg1 = '\0'; /* terminate so we get only program * name */ - post_opts = pg_strdup(arg1 + 1); /* point past whitespace */ + post_opts = pg_strdup(arg1 + 1); /* point past whitespace */ } if (exec_path == NULL) exec_path = pg_strdup(optline); @@ -1162,8 +1164,8 @@ do_promote(void) } /* - * For 9.3 onwards, "fast" promotion is performed. Promotion - * with a full checkpoint is still possible by writing a file called + * For 9.3 onwards, "fast" promotion is performed. Promotion with a full + * checkpoint is still possible by writing a file called * "fallback_promote" instead of "promote" */ snprintf(promote_file, MAXPGPATH, "%s/promote", pg_data); @@ -1211,7 +1213,7 @@ postmaster_is_alive(pid_t pid) * postmaster we are after. * * Don't believe that our own PID or parent shell's PID is the postmaster, - * either. (Windows hasn't got getppid(), though.) + * either. (Windows hasn't got getppid(), though.) */ if (pid == getpid()) return false; @@ -1273,7 +1275,8 @@ do_status(void) /* * The Linux Standard Base Core Specification 3.1 says this should return * '3, program is not running' - * https://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html + * https://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-gener + * ic/iniscrptact.html */ exit(3); } @@ -1298,20 +1301,23 @@ static bool IsWindowsXPOrGreater(void) { OSVERSIONINFO osv; + osv.dwOSVersionInfoSize = sizeof(osv); - /* Windows XP = Version 5.1 */ - return (!GetVersionEx(&osv) || /* could not get version */ + /* Windows XP = Version 5.1 */ + return (!GetVersionEx(&osv) || /* could not get version */ osv.dwMajorVersion > 5 || (osv.dwMajorVersion == 5 && osv.dwMinorVersion >= 1)); } -static bool IsWindows7OrGreater(void) +static bool +IsWindows7OrGreater(void) { OSVERSIONINFO osv; + osv.dwOSVersionInfoSize = sizeof(osv); - /* Windows 7 = Version 6.0 */ - return (!GetVersionEx(&osv) || /* could not get version */ + /* Windows 7 = Version 6.0 */ + return (!GetVersionEx(&osv) || /* could not get version */ osv.dwMajorVersion > 6 || (osv.dwMajorVersion == 6 && osv.dwMinorVersion >= 0)); } #endif diff --git a/src/bin/pg_ctl/t/001_start_stop.pl b/src/bin/pg_ctl/t/001_start_stop.pl index 49c1b1a66ad..f90dabffe53 100644 --- a/src/bin/pg_ctl/t/001_start_stop.pl +++ b/src/bin/pg_ctl/t/001_start_stop.pl @@ -9,17 +9,23 @@ program_help_ok('pg_ctl'); program_version_ok('pg_ctl'); program_options_handling_ok('pg_ctl'); -command_ok(['pg_ctl', 'initdb', '-D', "$tempdir/data"], 'pg_ctl initdb'); +command_ok([ 'pg_ctl', 'initdb', '-D', "$tempdir/data" ], 'pg_ctl initdb'); open CONF, ">>$tempdir/data/postgresql.conf"; print CONF "listen_addresses = ''\n"; print CONF "unix_socket_directories = '$tempdir'\n"; close CONF; -command_ok(['pg_ctl', 'start', '-D', "$tempdir/data", '-w'], 'pg_ctl start -w'); -command_ok(['pg_ctl', 'start', '-D', "$tempdir/data", '-w'], 'second pg_ctl start succeeds'); -command_ok(['pg_ctl', 'stop', '-D', "$tempdir/data", '-w', '-m', 'fast'], 'pg_ctl stop -w'); -command_fails(['pg_ctl', 'stop', '-D', "$tempdir/data", '-w', '-m', 'fast'], 'second pg_ctl stop fails'); +command_ok([ 'pg_ctl', 'start', '-D', "$tempdir/data", '-w' ], + 'pg_ctl start -w'); +command_ok([ 'pg_ctl', 'start', '-D', "$tempdir/data", '-w' ], + 'second pg_ctl start succeeds'); +command_ok([ 'pg_ctl', 'stop', '-D', "$tempdir/data", '-w', '-m', 'fast' ], + 'pg_ctl stop -w'); +command_fails([ 'pg_ctl', 'stop', '-D', "$tempdir/data", '-w', '-m', 'fast' ], + 'second pg_ctl stop fails'); -command_ok(['pg_ctl', 'restart', '-D', "$tempdir/data", '-w', '-m', 'fast'], 'pg_ctl restart with server not running'); -command_ok(['pg_ctl', 'restart', '-D', "$tempdir/data", '-w', '-m', 'fast'], 'pg_ctl restart with server running'); +command_ok([ 'pg_ctl', 'restart', '-D', "$tempdir/data", '-w', '-m', 'fast' ], + 'pg_ctl restart with server not running'); +command_ok([ 'pg_ctl', 'restart', '-D', "$tempdir/data", '-w', '-m', 'fast' ], + 'pg_ctl restart with server running'); system_or_bail 'pg_ctl', '-s', 'stop', '-D', "$tempdir/data", '-m', 'fast'; diff --git a/src/bin/pg_ctl/t/002_status.pl b/src/bin/pg_ctl/t/002_status.pl index e41c22fd5bd..bd397476527 100644 --- a/src/bin/pg_ctl/t/002_status.pl +++ b/src/bin/pg_ctl/t/002_status.pl @@ -11,9 +11,12 @@ print CONF "listen_addresses = ''\n"; print CONF "unix_socket_directories = '$tempdir'\n"; close CONF; -command_exit_is(['pg_ctl', 'status', '-D', "$tempdir/data"], 3, 'pg_ctl status with server not running'); +command_exit_is([ 'pg_ctl', 'status', '-D', "$tempdir/data" ], + 3, 'pg_ctl status with server not running'); -system_or_bail 'pg_ctl', '-s', '-l', "$tempdir/logfile", '-D', "$tempdir/data", '-w', 'start'; -command_exit_is(['pg_ctl', 'status', '-D', "$tempdir/data"], 0, 'pg_ctl status with server running'); +system_or_bail 'pg_ctl', '-s', '-l', "$tempdir/logfile", '-D', + "$tempdir/data", '-w', 'start'; +command_exit_is([ 'pg_ctl', 'status', '-D', "$tempdir/data" ], + 0, 'pg_ctl status with server running'); system_or_bail 'pg_ctl', '-s', 'stop', '-D', "$tempdir/data", '-m', 'fast'; diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 4d35ae54ccc..94e9147b133 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -37,7 +37,7 @@ static int numCatalogIds = 0; /* * These variables are static to avoid the notational cruft of having to pass - * them into findTableByOid() and friends. For each of these arrays, we + * them into findTableByOid() and friends. For each of these arrays, we * build a sorted-by-OID index array immediately after it's built, and then * we use binary search in findTableByOid() and friends. (qsort'ing the base * arrays themselves would be simpler, but it doesn't work because pg_dump.c @@ -487,7 +487,7 @@ findObjectByDumpId(DumpId dumpId) * * We use binary search in a sorted list that is built on first call. * If AssignDumpId() and findObjectByCatalogId() calls were freely intermixed, - * the code would work, but possibly be very slow. In the current usage + * the code would work, but possibly be very slow. In the current usage * pattern that does not happen, indeed we build the list at most twice. */ DumpableObject * diff --git a/src/bin/pg_dump/compress_io.c b/src/bin/pg_dump/compress_io.c index 06056b1c344..2e2a447ae78 100644 --- a/src/bin/pg_dump/compress_io.c +++ b/src/bin/pg_dump/compress_io.c @@ -561,7 +561,7 @@ cfopen(const char *path, const char *mode, int compression) int cfread(void *ptr, int size, cfp *fp) { - int ret; + int ret; if (size == 0) return 0; @@ -598,7 +598,7 @@ cfwrite(const void *ptr, int size, cfp *fp) int cfgetc(cfp *fp) { - int ret; + int ret; #ifdef HAVE_LIBZ if (fp->compressedfp) @@ -608,10 +608,10 @@ cfgetc(cfp *fp) { if (!gzeof(fp->compressedfp)) exit_horribly(modulename, - "could not read from input file: %s\n", strerror(errno)); + "could not read from input file: %s\n", strerror(errno)); else exit_horribly(modulename, - "could not read from input file: end of file\n"); + "could not read from input file: end of file\n"); } } else diff --git a/src/bin/pg_dump/dumputils.c b/src/bin/pg_dump/dumputils.c index 6161d88832f..259c4723378 100644 --- a/src/bin/pg_dump/dumputils.c +++ b/src/bin/pg_dump/dumputils.c @@ -184,7 +184,7 @@ fmtQualifiedId(int remoteVersion, const char *schema, const char *id) * standard_conforming_strings settings. * * This is essentially equivalent to libpq's PQescapeStringInternal, - * except for the output buffer structure. We need it in situations + * except for the output buffer structure. We need it in situations * where we do not have a PGconn available. Where we do, * appendStringLiteralConn is a better choice. */ @@ -359,7 +359,7 @@ appendByteaLiteral(PQExpBuffer buf, const unsigned char *str, size_t length, /* * This implementation is hard-wired to produce hex-format output. We do * not know the server version the output will be loaded into, so making - * an intelligent format choice is impossible. It might be better to + * an intelligent format choice is impossible. It might be better to * always use the old escaped format. */ if (!enlargePQExpBuffer(buf, 2 * length + 5)) @@ -393,7 +393,7 @@ appendByteaLiteral(PQExpBuffer buf, const unsigned char *str, size_t length, * into individual items. * * On success, returns true and sets *itemarray and *nitems to describe - * an array of individual strings. On parse failure, returns false; + * an array of individual strings. On parse failure, returns false; * *itemarray may exist or be NULL. * * NOTE: free'ing itemarray is sufficient to deallocate the working storage. @@ -533,7 +533,7 @@ buildACLCommands(const char *name, const char *subname, /* * At the end, these two will be pasted together to form the result. But * the owner privileges need to go before the other ones to keep the - * dependencies valid. In recent versions this is normally the case, but + * dependencies valid. In recent versions this is normally the case, but * in old versions they come after the PUBLIC privileges and that results * in problems if we need to run REVOKE on the owner privileges. */ @@ -706,7 +706,7 @@ buildDefaultACLCommands(const char *type, const char *nspname, /* * We incorporate the target role directly into the command, rather than - * playing around with SET ROLE or anything like that. This is so that a + * playing around with SET ROLE or anything like that. This is so that a * permissions error leads to nothing happening, rather than changing * default privileges for the wrong user. */ @@ -734,7 +734,7 @@ buildDefaultACLCommands(const char *type, const char *nspname, * * The returned grantee string will be the dequoted username or groupname * (preceded with "group " in the latter case). The returned grantor is - * the dequoted grantor name or empty. Privilege characters are decoded + * the dequoted grantor name or empty. Privilege characters are decoded * and split between privileges with grant option (privswgo) and without * (privs). * @@ -973,7 +973,7 @@ AddAcl(PQExpBuffer aclbuf, const char *keyword, const char *subname) * namevar: name of query variable to match against an object-name pattern. * altnamevar: NULL, or name of an alternative variable to match against name. * visibilityrule: clause to use if we want to restrict to visible objects - * (for example, "pg_catalog.pg_table_is_visible(p.oid)"). Can be NULL. + * (for example, "pg_catalog.pg_table_is_visible(p.oid)"). Can be NULL. * * Formatting note: the text already present in buf should end with a newline. * The appended text, if any, will end with one too. @@ -1020,7 +1020,7 @@ processSQLNamePattern(PGconn *conn, PQExpBuffer buf, const char *pattern, * last alternatives which is not what we want. * * Note: the result of this pass is the actual regexp pattern(s) we want - * to execute. Quoting/escaping into SQL literal format will be done + * to execute. Quoting/escaping into SQL literal format will be done * below using appendStringLiteralConn(). */ appendPQExpBufferStr(&namebuf, "^("); diff --git a/src/bin/pg_dump/parallel.c b/src/bin/pg_dump/parallel.c index afe941f80b8..caedbb8b4a4 100644 --- a/src/bin/pg_dump/parallel.c +++ b/src/bin/pg_dump/parallel.c @@ -166,7 +166,7 @@ GetMyPSlot(ParallelState *pstate) } /* - * 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. * * This is defined in parallel.c, because in parallel mode, things are more * complicated. If the worker process does exit_horribly(), we forward its @@ -673,7 +673,7 @@ ParallelBackupEnd(ArchiveHandle *AH, ParallelState *pstate) * AH->MasterStartParallelItemPtr, a routine of the output format. This * function's arguments are the parents archive handle AH (containing the full * catalog information), the TocEntry that the worker should work on and a - * T_Action act indicating whether this is a backup or a restore item. The + * T_Action act indicating whether this is a backup or a restore item. The * function then converts the TocEntry assignment into a string that is then * sent over to the worker process. In the simplest case that would be * something like "DUMP 1234", with 1234 being the TocEntry id. @@ -840,8 +840,8 @@ lockTableNoWait(ArchiveHandle *AH, TocEntry *te) if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) exit_horribly(modulename, "could not obtain lock on relation \"%s\"\n" - "This usually means that someone requested an ACCESS EXCLUSIVE lock " - "on the table after the pg_dump parent process had gotten the " + "This usually means that someone requested an ACCESS EXCLUSIVE lock " + "on the table after the pg_dump parent process had gotten the " "initial ACCESS SHARE lock on the table.\n", qualId); PQclear(res); @@ -923,7 +923,7 @@ WaitForCommands(ArchiveHandle *AH, int pipefd[2]) } else exit_horribly(modulename, - "unrecognized command on communication channel: %s\n", + "unrecognized command on communication channel: %s\n", command); /* command was pg_malloc'd and we are responsible for free()ing it. */ @@ -1251,7 +1251,7 @@ sendMessageToWorker(ParallelState *pstate, int worker, const char *str) if (!aborting) #endif exit_horribly(modulename, - "could not write to the communication channel: %s\n", + "could not write to the communication channel: %s\n", strerror(errno)); } } diff --git a/src/bin/pg_dump/pg_backup.h b/src/bin/pg_dump/pg_backup.h index 08ace67db4b..25780cfc1a0 100644 --- a/src/bin/pg_dump/pg_backup.h +++ b/src/bin/pg_dump/pg_backup.h @@ -208,7 +208,7 @@ extern RestoreOptions *NewRestoreOptions(void); extern void SortTocFromFile(Archive *AHX, RestoreOptions *ropt); /* Convenience functions used only when writing DATA */ -extern void archputs(const char *s, Archive *AH); +extern void archputs(const char *s, Archive *AH); extern int archprintf(Archive *AH, const char *fmt,...) /* This extension allows gcc to check the format string */ diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c index 2fa21193f51..e782438a86e 100644 --- a/src/bin/pg_dump/pg_backup_archiver.c +++ b/src/bin/pg_dump/pg_backup_archiver.c @@ -423,7 +423,7 @@ RestoreArchive(Archive *AHX) { if (!ropt->if_exists) { - /* No --if-exists? Then just use the original */ + /* No --if-exists? Then just use the original */ ahprintf(AH, "%s", te->dropStmt); } else @@ -432,7 +432,7 @@ RestoreArchive(Archive *AHX) char *mark; char *dropStmt = pg_strdup(te->dropStmt); char *dropStmtPtr = dropStmt; - PQExpBuffer ftStmt = createPQExpBuffer(); + PQExpBuffer ftStmt = createPQExpBuffer(); /* * Need to inject IF EXISTS clause after ALTER TABLE @@ -449,12 +449,12 @@ RestoreArchive(Archive *AHX) * ALTER TABLE..ALTER COLUMN..DROP DEFAULT does not * support the IF EXISTS clause, and therefore we * simply emit the original command for such objects. - * For other objects, we need to extract the first part - * of the DROP which includes the object type. Most of - * the time this matches te->desc, so search for that; - * however for the different kinds of CONSTRAINTs, we - * know to search for hardcoded "DROP CONSTRAINT" - * instead. + * For other objects, we need to extract the first + * part of the DROP which includes the object type. + * Most of the time this matches te->desc, so search + * for that; however for the different kinds of + * CONSTRAINTs, we know to search for hardcoded "DROP + * CONSTRAINT" instead. */ if (strcmp(te->desc, "DEFAULT") == 0) appendPQExpBuffer(ftStmt, "%s", dropStmt); @@ -712,8 +712,8 @@ restore_toc_entry(ArchiveHandle *AH, TocEntry *te, /* * In parallel restore, if we created the table earlier in * the run then we wrap the COPY in a transaction and - * precede it with a TRUNCATE. If archiving is not on - * this prevents WAL-logging the COPY. This obtains a + * precede it with a TRUNCATE. If archiving is not on + * this prevents WAL-logging the COPY. This obtains a * speedup similar to that from using single_txn mode in * non-parallel restores. */ @@ -1492,8 +1492,8 @@ dump_lo_buf(ArchiveHandle *AH) void ahwrite(const void *ptr, size_t size, size_t nmemb, ArchiveHandle *AH) { - int bytes_written = 0; - + int bytes_written = 0; + if (AH->writingBlob) { size_t remaining = size * nmemb; @@ -1518,6 +1518,7 @@ ahwrite(const void *ptr, size_t size, size_t nmemb, ArchiveHandle *AH) bytes_written = GZWRITE(ptr, size, nmemb, AH->OF); else if (AH->CustomOutPtr) bytes_written = AH->CustomOutPtr (AH, ptr, size * nmemb); + else { /* @@ -1525,7 +1526,7 @@ ahwrite(const void *ptr, size_t size, size_t nmemb, ArchiveHandle *AH) * connected then send it to the DB. */ if (RestoringToDB(AH)) - bytes_written = ExecuteSqlCommandBuf(AH, (const char *) ptr, size * nmemb); + bytes_written = ExecuteSqlCommandBuf(AH, (const char *) ptr, size * nmemb); else bytes_written = fwrite(ptr, size, nmemb, AH->OF) * size; } @@ -1623,7 +1624,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. */ @@ -1647,7 +1648,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. */ @@ -1838,8 +1839,8 @@ WriteStr(ArchiveHandle *AH, const char *c) if (c) { - int len = strlen(c); - + int len = strlen(c); + res = WriteInt(AH, len); (*AH->WriteBufPtr) (AH, c, len); res += len; @@ -1958,7 +1959,7 @@ _discoverArchiveFormat(ArchiveHandle *AH) if (strncmp(sig, "PGDMP", 5) == 0) { - int byteread; + int byteread; /* * Finish reading (most of) a custom-format header. @@ -2709,7 +2710,7 @@ _doSetSessionAuth(ArchiveHandle *AH, const char *user) appendPQExpBufferStr(cmd, "SET SESSION AUTHORIZATION "); /* - * SQL requires a string literal here. Might as well be correct. + * SQL requires a string literal here. Might as well be correct. */ if (user && *user) appendStringLiteralAHX(cmd, user, AH); @@ -2840,7 +2841,7 @@ _becomeUser(ArchiveHandle *AH, const char *user) } /* - * Become the owner of the given TOC entry object. If + * Become the owner of the given TOC entry object. If * changes in ownership are not allowed, this doesn't do anything. */ static void @@ -2995,7 +2996,7 @@ _getObjectDescription(PQExpBuffer buf, TocEntry *te, ArchiveHandle *AH) strcmp(type, "FOREIGN TABLE") == 0 || strcmp(type, "TEXT SEARCH DICTIONARY") == 0 || strcmp(type, "TEXT SEARCH CONFIGURATION") == 0 || - /* non-schema-specified objects */ + /* non-schema-specified objects */ strcmp(type, "DATABASE") == 0 || strcmp(type, "PROCEDURAL LANGUAGE") == 0 || strcmp(type, "SCHEMA") == 0 || @@ -3310,7 +3311,7 @@ ReadHead(ArchiveHandle *AH) /* * If we haven't already read the header, do so. * - * NB: this code must agree with _discoverArchiveFormat(). Maybe find a + * NB: this code must agree with _discoverArchiveFormat(). Maybe find a * way to unify the cases? */ if (!AH->readHeader) @@ -3419,7 +3420,7 @@ checkSeek(FILE *fp) return false; /* - * Check that fseeko(SEEK_SET) works, too. NB: we used to try to test + * Check that fseeko(SEEK_SET) works, too. NB: we used to try to test * this with fseeko(fp, 0, SEEK_CUR). But some platforms treat that as a * successful no-op even on files that are otherwise unseekable. */ @@ -3459,7 +3460,7 @@ dumpTimestamp(ArchiveHandle *AH, const char *msg, time_t tim) * * Work is done in three phases. * First we process all SECTION_PRE_DATA tocEntries, in a single connection, - * just as for a standard restore. Second we process the remaining non-ACL + * just as for a standard restore. Second we process the remaining non-ACL * steps in parallel worker children (threads on Windows, processes on Unix), * each of which connects separately to the database. Finally we process all * the ACL entries in a single connection (that happens back in @@ -3481,7 +3482,7 @@ restore_toc_entries_prefork(ArchiveHandle *AH) * Do all the early stuff in a single connection in the parent. There's no * great point in running it in parallel, in fact it will actually run * faster in a single connection because we avoid all the connection and - * setup overhead. Also, pre-9.2 pg_dump versions were not very good + * setup overhead. Also, pre-9.2 pg_dump versions were not very good * about showing all the dependencies of SECTION_PRE_DATA items, so we do * not risk trying to process them out-of-order. * @@ -3527,7 +3528,7 @@ restore_toc_entries_prefork(ArchiveHandle *AH) } /* - * Now close parent connection in prep for parallel steps. We do this + * Now close parent connection in prep for parallel steps. We do this * mainly to ensure that we don't exceed the specified number of parallel * connections. */ @@ -3572,7 +3573,7 @@ restore_toc_entries_parallel(ArchiveHandle *AH, ParallelState *pstate, /* * Initialize the lists of ready items, the list for pending items has - * already been initialized in the caller. After this setup, the pending + * already been initialized in the caller. After this setup, the pending * list is everything that needs to be done but is blocked by one or more * dependencies, while the ready list contains items that have no * remaining dependencies. Note: we don't yet filter out entries that diff --git a/src/bin/pg_dump/pg_backup_archiver.h b/src/bin/pg_dump/pg_backup_archiver.h index 92ec1d89c6c..c163f29baf0 100644 --- a/src/bin/pg_dump/pg_backup_archiver.h +++ b/src/bin/pg_dump/pg_backup_archiver.h @@ -132,7 +132,7 @@ struct ParallelState; exit_horribly(modulename, "could not write to output file: %s\n", \ strerror(errno)); \ } while (0) - + typedef enum T_Action { ACT_DUMP, diff --git a/src/bin/pg_dump/pg_backup_custom.c b/src/bin/pg_dump/pg_backup_custom.c index 5f3a9100896..06cd0a7864a 100644 --- a/src/bin/pg_dump/pg_backup_custom.c +++ b/src/bin/pg_dump/pg_backup_custom.c @@ -610,7 +610,7 @@ static int _WriteByte(ArchiveHandle *AH, const int i) { lclContext *ctx = (lclContext *) AH->formatData; - int res; + int res; if ((res = fputc(i, AH->FH)) == EOF) WRITE_ERROR_EXIT; diff --git a/src/bin/pg_dump/pg_backup_db.c b/src/bin/pg_dump/pg_backup_db.c index 980d68fdabd..762a9a8781b 100644 --- a/src/bin/pg_dump/pg_backup_db.c +++ b/src/bin/pg_dump/pg_backup_db.c @@ -60,7 +60,7 @@ _check_database_version(ArchiveHandle *AH) /* * Reconnect to the server. If dbname is not NULL, use that database, * else the one associated with the archive handle. If username is - * not NULL, use that user name, else the one from the handle. If + * not NULL, use that user name, else the one from the handle. If * both the database and the user match the existing connection already, * nothing will be done. * @@ -101,7 +101,7 @@ ReconnectToServer(ArchiveHandle *AH, const char *dbname, const char *username) * * Note: it's not really all that sensible to use a single-entry password * cache if the username keeps changing. In current usage, however, the - * username never does change, so one savedPassword is sufficient. We do + * username never does change, so one savedPassword is sufficient. We do * update the cache on the off chance that the password has changed since the * start of the run. */ diff --git a/src/bin/pg_dump/pg_backup_directory.c b/src/bin/pg_dump/pg_backup_directory.c index 2cd9b7e9f8e..39e29d80221 100644 --- a/src/bin/pg_dump/pg_backup_directory.c +++ b/src/bin/pg_dump/pg_backup_directory.c @@ -357,7 +357,7 @@ _WriteData(ArchiveHandle *AH, const void *data, size_t dLen) /* Are we aborting? */ checkAborting(AH); - + if (dLen > 0 && cfwrite(data, dLen, ctx->dataFH) != dLen) WRITE_ERROR_EXIT; @@ -408,7 +408,7 @@ _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)); } @@ -543,8 +543,8 @@ _ReadBuf(ArchiveHandle *AH, void *buf, size_t len) lclContext *ctx = (lclContext *) AH->formatData; /* - * If there was an I/O error, we already exited in cfread(), - * so here we exit on short reads. + * If there was an I/O error, we already exited in cfread(), so here we + * exit on short reads. */ if (cfread(buf, len, ctx->dataFH) != len) exit_horribly(modulename, diff --git a/src/bin/pg_dump/pg_backup_tar.c b/src/bin/pg_dump/pg_backup_tar.c index f5053930571..0cb72650b01 100644 --- a/src/bin/pg_dump/pg_backup_tar.c +++ b/src/bin/pg_dump/pg_backup_tar.c @@ -560,7 +560,7 @@ _tarReadRaw(ArchiveHandle *AH, void *buf, size_t len, TAR_MEMBER *th, FILE *fh) res = GZREAD(&((char *) buf)[used], 1, len, th->zFH); if (res != len && !GZEOF(fh)) exit_horribly(modulename, - "could not read from input file: %s\n", strerror(errno)); + "could not read from input file: %s\n", strerror(errno)); } else { @@ -821,7 +821,7 @@ _ReadBuf(ArchiveHandle *AH, void *buf, size_t len) /* We already would have exited for errors on reads, must be EOF */ exit_horribly(modulename, "could not read from input file: end of file\n"); - + ctx->filePos += len; return; } diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index c2bb6161b21..e52591606f5 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -86,10 +86,10 @@ bool g_verbose; /* User wants verbose narration of our * activities. */ /* various user-settable parameters */ -static bool schemaOnly; -static bool dataOnly; +static bool schemaOnly; +static bool dataOnly; static int dumpSections; /* bitmask of chosen sections */ -static bool aclsSkip; +static bool aclsSkip; static const char *lockWaitTimeout; /* subquery used to convert user ID (eg, datdba) to user name */ @@ -227,7 +227,7 @@ static void makeTableDataInfo(TableInfo *tbinfo, bool oids); static void buildMatViewRefreshDependencies(Archive *fout); static void getTableDataFKConstraints(void); static char *format_function_arguments(FuncInfo *finfo, char *funcargs, - bool is_agg); + bool is_agg); static char *format_function_arguments_old(Archive *fout, FuncInfo *finfo, int nallargs, char **allargtypes, @@ -1267,7 +1267,7 @@ selectDumpableTable(TableInfo *tbinfo) * Mark a type as to be dumped or not * * If it's a table's rowtype or an autogenerated array type, we also apply a - * special type code to facilitate sorting into the desired order. (We don't + * special type code to facilitate sorting into the desired order. (We don't * want to consider those to be ordinary types because that would bring tables * up into the datatype part of the dump order.) We still set the object's * dump flag; that's not going to cause the dummy type to be dumped, but we @@ -1669,7 +1669,7 @@ dumpTableData_insert(Archive *fout, void *dcontext) /* * These types are printed without quotes unless * they contain values that aren't accepted by the - * scanner unquoted (e.g., 'NaN'). Note that + * scanner unquoted (e.g., 'NaN'). Note that * strtod() and friends might accept NaN, so we * can't use that to test. * @@ -1930,31 +1930,31 @@ buildMatViewRefreshDependencies(Archive *fout) query = createPQExpBuffer(); appendPQExpBufferStr(query, "WITH RECURSIVE w AS " - "( " + "( " "SELECT d1.objid, d2.refobjid, c2.relkind AS refrelkind " - "FROM pg_depend d1 " - "JOIN pg_class c1 ON c1.oid = d1.objid " - "AND c1.relkind = 'm' " - "JOIN pg_rewrite r1 ON r1.ev_class = d1.objid " + "FROM pg_depend d1 " + "JOIN pg_class c1 ON c1.oid = d1.objid " + "AND c1.relkind = 'm' " + "JOIN pg_rewrite r1 ON r1.ev_class = d1.objid " "JOIN pg_depend d2 ON d2.classid = 'pg_rewrite'::regclass " - "AND d2.objid = r1.oid " - "AND d2.refobjid <> d1.objid " - "JOIN pg_class c2 ON c2.oid = d2.refobjid " - "AND c2.relkind IN ('m','v') " - "WHERE d1.classid = 'pg_class'::regclass " - "UNION " - "SELECT w.objid, d3.refobjid, c3.relkind " - "FROM w " - "JOIN pg_rewrite r3 ON r3.ev_class = w.refobjid " + "AND d2.objid = r1.oid " + "AND d2.refobjid <> d1.objid " + "JOIN pg_class c2 ON c2.oid = d2.refobjid " + "AND c2.relkind IN ('m','v') " + "WHERE d1.classid = 'pg_class'::regclass " + "UNION " + "SELECT w.objid, d3.refobjid, c3.relkind " + "FROM w " + "JOIN pg_rewrite r3 ON r3.ev_class = w.refobjid " "JOIN pg_depend d3 ON d3.classid = 'pg_rewrite'::regclass " - "AND d3.objid = r3.oid " - "AND d3.refobjid <> w.refobjid " - "JOIN pg_class c3 ON c3.oid = d3.refobjid " - "AND c3.relkind IN ('m','v') " - ") " + "AND d3.objid = r3.oid " + "AND d3.refobjid <> w.refobjid " + "JOIN pg_class c3 ON c3.oid = d3.refobjid " + "AND c3.relkind IN ('m','v') " + ") " "SELECT 'pg_class'::regclass::oid AS classid, objid, refobjid " - "FROM w " - "WHERE refrelkind = 'm'"); + "FROM w " + "WHERE refrelkind = 'm'"); res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK); @@ -2065,7 +2065,7 @@ getTableDataFKConstraints(void) /* * guessConstraintInheritance: * In pre-8.4 databases, we can't tell for certain which constraints - * are inherited. We assume a CHECK constraint is inherited if its name + * are inherited. We assume a CHECK constraint is inherited if its name * matches the name of any constraint in the parent. Originally this code * tried to compare the expression texts, but that can fail for various * reasons --- for example, if the parent and child tables are in different @@ -2830,7 +2830,7 @@ binary_upgrade_set_pg_class_oids(Archive *fout, pg_index_indexrelid = atooid(PQgetvalue(upgrade_res, 0, PQfnumber(upgrade_res, "indexrelid"))); appendPQExpBufferStr(upgrade_buffer, - "\n-- For binary upgrade, must preserve pg_class oids\n"); + "\n-- For binary upgrade, must preserve pg_class oids\n"); if (!is_index) { @@ -3020,7 +3020,7 @@ getNamespaces(Archive *fout, int *numNamespaces) * getNamespaces * * NB: for pre-7.3 source database, we use object OID to guess whether it's - * a system object or not. In 7.3 and later there is no guessing, and we + * a system object or not. In 7.3 and later there is no guessing, and we * don't use objoid at all. */ static NamespaceInfo * @@ -3179,7 +3179,7 @@ getTypes(Archive *fout, int *numTypes) * auto-generated array type by checking the element type's typarray. * (Before that the test is capable of generating false positives.) We * still check for name beginning with '_', though, so as to avoid the - * cost of the subselect probe for all standard types. This would have to + * cost of the subselect probe for all standard types. This would have to * be revisited if the backend ever allows renaming of array types. */ @@ -3324,8 +3324,8 @@ 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 + * 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 * definition in case they have a canonicalize function. * * Note: the shell type doesn't have a catId. You might think it @@ -4078,7 +4078,7 @@ getFuncs(Archive *fout, int *numFuncs) * Find all user-defined functions. Normally we can exclude functions in * pg_catalog, which is worth doing since there are several thousand of * 'em. However, there are some extensions that create functions in - * pg_catalog. In normal dumps we can still ignore those --- but in + * pg_catalog. In normal dumps we can still ignore those --- but in * binary-upgrade mode, we must dump the member objects of the extension, * so be sure to fetch any such functions. * @@ -4106,12 +4106,12 @@ getFuncs(Archive *fout, int *numFuncs) username_subquery); if (fout->remoteVersion >= 90200) appendPQExpBufferStr(query, - "\n AND NOT EXISTS (SELECT 1 FROM pg_depend " + "\n AND NOT EXISTS (SELECT 1 FROM pg_depend " "WHERE classid = 'pg_proc'::regclass AND " "objid = p.oid AND deptype = 'i')"); if (binary_upgrade && fout->remoteVersion >= 90100) appendPQExpBufferStr(query, - "\n OR EXISTS(SELECT 1 FROM pg_depend WHERE " + "\n OR EXISTS(SELECT 1 FROM pg_depend WHERE " "classid = 'pg_proc'::regclass AND " "objid = p.oid AND " "refclassid = 'pg_extension'::regclass AND " @@ -4312,9 +4312,9 @@ getTables(Archive *fout, int *numTables) "d.refobjid AS owning_tab, " "d.refobjsubid AS owning_col, " "(SELECT spcname FROM pg_tablespace t WHERE t.oid = c.reltablespace) AS reltablespace, " - "array_to_string(array_remove(array_remove(c.reloptions,'check_option=local'),'check_option=cascaded'), ', ') AS reloptions, " + "array_to_string(array_remove(array_remove(c.reloptions,'check_option=local'),'check_option=cascaded'), ', ') AS reloptions, " "CASE WHEN 'check_option=local' = ANY (c.reloptions) THEN 'LOCAL'::text " - "WHEN 'check_option=cascaded' = ANY (c.reloptions) THEN 'CASCADED'::text ELSE NULL END AS checkoption, " + "WHEN 'check_option=cascaded' = ANY (c.reloptions) THEN 'CASCADED'::text ELSE NULL END AS checkoption, " "array_to_string(array(SELECT 'toast.' || x FROM unnest(tc.reloptions) x), ', ') AS toast_reloptions " "FROM pg_class c " "LEFT JOIN pg_depend d ON " @@ -4351,9 +4351,9 @@ getTables(Archive *fout, int *numTables) "d.refobjid AS owning_tab, " "d.refobjsubid AS owning_col, " "(SELECT spcname FROM pg_tablespace t WHERE t.oid = c.reltablespace) AS reltablespace, " - "array_to_string(array_remove(array_remove(c.reloptions,'check_option=local'),'check_option=cascaded'), ', ') AS reloptions, " + "array_to_string(array_remove(array_remove(c.reloptions,'check_option=local'),'check_option=cascaded'), ', ') AS reloptions, " "CASE WHEN 'check_option=local' = ANY (c.reloptions) THEN 'LOCAL'::text " - "WHEN 'check_option=cascaded' = ANY (c.reloptions) THEN 'CASCADED'::text ELSE NULL END AS checkoption, " + "WHEN 'check_option=cascaded' = ANY (c.reloptions) THEN 'CASCADED'::text ELSE NULL END AS checkoption, " "array_to_string(array(SELECT 'toast.' || x FROM unnest(tc.reloptions) x), ', ') AS toast_reloptions " "FROM pg_class c " "LEFT JOIN pg_depend d ON " @@ -4796,7 +4796,7 @@ getTables(Archive *fout, int *numTables) selectDumpableTable(&tblinfo[i]); tblinfo[i].interesting = tblinfo[i].dobj.dump; - tblinfo[i].postponed_def = false; /* might get set during sort */ + tblinfo[i].postponed_def = false; /* might get set during sort */ /* * Read-lock target tables to make sure they aren't DROPPED or altered @@ -5240,7 +5240,7 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables) /* * In pre-7.4 releases, indkeys may contain more entries than * indnkeys says (since indnkeys will be 1 for a functional - * index). We don't actually care about this case since we don't + * index). We don't actually care about this case since we don't * examine indkeys except for indexes associated with PRIMARY and * UNIQUE constraints, which are never functional indexes. But we * have to allocate enough space to keep parseOidArray from @@ -5489,7 +5489,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. */ @@ -6152,7 +6152,7 @@ getCasts(Archive *fout, int *numCasts) "FROM pg_type t1, pg_type t2, pg_proc p " "WHERE p.pronargs = 1 AND " "p.proargtypes[0] = t1.oid AND " - "p.prorettype = t2.oid AND p.proname = t2.typname " + "p.prorettype = t2.oid AND p.proname = t2.typname " "ORDER BY 3,4"); } @@ -6325,7 +6325,7 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables) else if (fout->remoteVersion >= 90100) { /* - * attcollation is new in 9.1. Since we only want to dump COLLATE + * attcollation is new in 9.1. Since we only want to dump COLLATE * clauses for attributes whose collation is different from their * type's default, we use a CASE here to suppress uninteresting * attcollations cheaply. @@ -6580,7 +6580,7 @@ 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 + * 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. */ @@ -6777,7 +6777,7 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables) /* * If the constraint is inherited, this will be detected later - * (in pre-8.4 databases). We also detect later if the + * (in pre-8.4 databases). We also detect later if the * constraint must be split out from the table definition. */ } @@ -7619,7 +7619,7 @@ findComments(Archive *fout, Oid classoid, Oid objoid, /* * Pre-7.2, pg_description does not contain classoid, so collectComments - * just stores a zero. If there's a collision on object OID, well, you + * just stores a zero. If there's a collision on object OID, well, you * get duplicate comments. */ if (fout->remoteVersion < 70200) @@ -7996,7 +7996,7 @@ dumpExtension(Archive *fout, ExtensionInfo *extinfo) /* * We unconditionally create the extension, so we must drop it if it - * exists. This could happen if the user deleted 'plpgsql' and then + * exists. This could happen if the user deleted 'plpgsql' and then * readded it, causing its oid to be greater than FirstNormalObjectId. * The FirstNormalObjectId test was kept to avoid repeatedly dropping * and recreating extensions like 'plpgsql'. @@ -8004,7 +8004,7 @@ dumpExtension(Archive *fout, ExtensionInfo *extinfo) appendPQExpBuffer(q, "DROP EXTENSION IF EXISTS %s;\n", qextname); appendPQExpBufferStr(q, - "SELECT binary_upgrade.create_empty_extension("); + "SELECT binary_upgrade.create_empty_extension("); appendStringLiteralAH(q, extinfo->dobj.name, fout); appendPQExpBufferStr(q, ", "); appendStringLiteralAH(q, extinfo->namespace, fout); @@ -8015,7 +8015,7 @@ dumpExtension(Archive *fout, ExtensionInfo *extinfo) /* * Note that we're pushing extconfig (an OID array) back into - * pg_extension exactly as-is. This is OK because pg_class OIDs are + * pg_extension exactly as-is. This is OK because pg_class OIDs are * preserved in binary upgrade. */ if (strlen(extinfo->extconfig) > 2) @@ -8944,7 +8944,7 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo) if (fout->remoteVersion >= 90100) { /* - * attcollation is new in 9.1. Since we only want to dump COLLATE + * attcollation is new in 9.1. Since we only want to dump COLLATE * clauses for attributes whose collation is different from their * type's default, we use a CASE here to suppress uninteresting * attcollations cheaply. atttypid will be 0 for dropped columns; @@ -9258,7 +9258,7 @@ dumpShellType(Archive *fout, ShellTypeInfo *stinfo) /* * Note the lack of a DROP command for the shell type; any required DROP - * is driven off the base type entry, instead. This interacts with + * is driven off the base type entry, instead. This interacts with * _printTocEntry()'s use of the presence of a DROP command to decide * whether an entry needs an ALTER OWNER command. We don't want to alter * the shell type's owner immediately on creation; that should happen only @@ -9295,7 +9295,7 @@ dumpShellType(Archive *fout, ShellTypeInfo *stinfo) * * For some backwards compatibility with the older behavior, we forcibly * dump a PL if its handler function (and validator if any) are in a - * dumpable namespace. That case is not checked here. + * dumpable namespace. That case is not checked here. * * Also, if the PL belongs to an extension, we do not use this heuristic. * That case isn't checked here either. @@ -9619,7 +9619,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) PQExpBuffer asPart; PGresult *res; char *funcsig; /* identity signature */ - char *funcfullsig = NULL; /* full signature */ + char *funcfullsig = NULL; /* full signature */ char *funcsig_tag; char *proretset; char *prosrc; @@ -9982,7 +9982,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) /* * COST and ROWS are emitted only if present and not default, so as not to - * break backwards-compatibility of the dump without need. Keep this code + * break backwards-compatibility of the dump without need. Keep this code * in sync with the defaults in functioncmds.c. */ if (strcmp(procost, "0") != 0) @@ -10779,7 +10779,7 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo) * XXX RECHECK is gone as of 8.4, but we'll still print it if dumping an * older server's opclass in which it is used. This is to avoid * hard-to-detect breakage if a newer pg_dump is used to dump from an - * older server and then reload into that old version. This can go away + * older server and then reload into that old version. This can go away * once 8.3 is so old as to not be of interest to anyone. */ resetPQExpBuffer(query); @@ -11057,7 +11057,7 @@ dumpOpfamily(Archive *fout, OpfamilyInfo *opfinfo) * XXX RECHECK is gone as of 8.4, but we'll still print it if dumping an * older server's opclass in which it is used. This is to avoid * hard-to-detect breakage if a newer pg_dump is used to dump from an - * older server and then reload into that old version. This can go away + * older server and then reload into that old version. This can go away * once 8.3 is so old as to not be of interest to anyone. */ if (fout->remoteVersion >= 90100) @@ -11606,8 +11606,8 @@ dumpAgg(Archive *fout, AggInfo *agginfo) "aggtransspace, agginitval, " "aggmtransspace, aggminitval, " "true AS convertok, " - "pg_catalog.pg_get_function_arguments(p.oid) AS funcargs, " - "pg_catalog.pg_get_function_identity_arguments(p.oid) AS funciargs " + "pg_catalog.pg_get_function_arguments(p.oid) AS funcargs, " + "pg_catalog.pg_get_function_identity_arguments(p.oid) AS funciargs " "FROM pg_catalog.pg_aggregate a, pg_catalog.pg_proc p " "WHERE a.aggfnoid = p.oid " "AND p.oid = '%u'::pg_catalog.oid", @@ -11625,8 +11625,8 @@ dumpAgg(Archive *fout, AggInfo *agginfo) "0 AS aggtransspace, agginitval, " "0 AS aggmtransspace, NULL AS aggminitval, " "true AS convertok, " - "pg_catalog.pg_get_function_arguments(p.oid) AS funcargs, " - "pg_catalog.pg_get_function_identity_arguments(p.oid) AS funciargs " + "pg_catalog.pg_get_function_arguments(p.oid) AS funcargs, " + "pg_catalog.pg_get_function_identity_arguments(p.oid) AS funciargs " "FROM pg_catalog.pg_aggregate a, pg_catalog.pg_proc p " "WHERE a.aggfnoid = p.oid " "AND p.oid = '%u'::pg_catalog.oid", @@ -11644,7 +11644,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) "0 AS aggtransspace, agginitval, " "0 AS aggmtransspace, NULL AS aggminitval, " "true AS convertok " - "FROM pg_catalog.pg_aggregate a, pg_catalog.pg_proc p " + "FROM pg_catalog.pg_aggregate a, pg_catalog.pg_proc p " "WHERE a.aggfnoid = p.oid " "AND p.oid = '%u'::pg_catalog.oid", agginfo->aggfn.dobj.catId.oid); @@ -12478,7 +12478,7 @@ dumpUserMappings(Archive *fout, * to fail if run by a non-superuser. Note that the view will show * umoptions as null if the user hasn't got privileges for the associated * server; this means that pg_dump will dump such a mapping, but with no - * OPTIONS clause. A possible alternative is to skip such mappings + * OPTIONS clause. A possible alternative is to skip such mappings * altogether, but it's not clear that that's an improvement. */ selectSourceSchema(fout, "pg_catalog"); @@ -12620,7 +12620,7 @@ dumpDefaultACL(Archive *fout, DefaultACLInfo *daclinfo) * 'type' must be one of * TABLE, SEQUENCE, FUNCTION, LANGUAGE, SCHEMA, DATABASE, TABLESPACE, * FOREIGN DATA WRAPPER, SERVER, or LARGE OBJECT. - * 'name' is the formatted name of the object. Must be quoted etc. already. + * 'name' is the formatted name of the object. Must be quoted etc. already. * 'subname' is the formatted name of the sub-object, if any. Must be quoted. * 'tag' is the tag for the archive entry (typ. unquoted name of object). * 'nspname' is the namespace the object is in (NULL if none). @@ -12991,7 +12991,7 @@ dumpTable(Archive *fout, TableInfo *tbinfo) tbinfo->relacl); /* - * Handle column ACLs, if any. Note: we pull these with a separate + * Handle column ACLs, if any. Note: we pull these with a separate * query rather than trying to fetch them during getTableAttrs, so * that we won't miss ACLs on system columns. */ @@ -13427,7 +13427,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) * physical column order, including dropped columns, as in the * original. Therefore, we create dropped columns above and drop them * here, also updating their attlen/attalign values so that the - * dropped column can be skipped properly. (We do not bother with + * dropped column can be skipped properly. (We do not bother with * restoring the original attbyval setting.) Also, inheritance * relationships are set up by doing ALTER INHERIT rather than using * an INHERITS clause --- the latter would possibly mess up the column @@ -13436,7 +13436,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) * Analogously, we set up typed tables using ALTER TABLE / OF here. */ if (binary_upgrade && (tbinfo->relkind == RELKIND_RELATION || - tbinfo->relkind == RELKIND_FOREIGN_TABLE) ) + tbinfo->relkind == RELKIND_FOREIGN_TABLE)) { for (j = 0; j < tbinfo->numatts; j++) { @@ -13469,8 +13469,8 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) Assert(tbinfo->relkind != RELKIND_FOREIGN_TABLE); appendPQExpBufferStr(q, "\n-- For binary upgrade, recreate inherited column.\n"); appendPQExpBufferStr(q, "UPDATE pg_catalog.pg_attribute\n" - "SET attislocal = false\n" - "WHERE attname = "); + "SET attislocal = false\n" + "WHERE attname = "); appendStringLiteralAH(q, tbinfo->attnames[j], fout); appendPQExpBufferStr(q, "\n AND attrelid = "); appendStringLiteralAH(q, fmtId(tbinfo->dobj.name), fout); @@ -13492,8 +13492,8 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) fmtId(constr->dobj.name)); appendPQExpBuffer(q, "%s;\n", constr->condef); appendPQExpBufferStr(q, "UPDATE pg_catalog.pg_constraint\n" - "SET conislocal = false\n" - "WHERE contype = 'c' AND conname = "); + "SET conislocal = false\n" + "WHERE contype = 'c' AND conname = "); appendStringLiteralAH(q, constr->dobj.name, fout); appendPQExpBufferStr(q, "\n AND conrelid = "); appendStringLiteralAH(q, fmtId(tbinfo->dobj.name), fout); @@ -13555,8 +13555,8 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) { appendPQExpBufferStr(q, "\n-- For binary upgrade, mark materialized view as populated\n"); appendPQExpBufferStr(q, "UPDATE pg_catalog.pg_class\n" - "SET relispopulated = 't'\n" - "WHERE oid = "); + "SET relispopulated = 't'\n" + "WHERE oid = "); appendStringLiteralAH(q, fmtId(tbinfo->dobj.name), fout); appendPQExpBufferStr(q, "::pg_catalog.regclass;\n"); } @@ -13839,10 +13839,10 @@ dumpIndex(Archive *fout, IndxInfo *indxinfo) /* * If there's an associated constraint, don't dump the index per se, but - * do dump any comment for it. (This is safe because dependency ordering - * will have ensured the constraint is emitted first.) Note that the - * emitted comment has to be shown as depending on the constraint, not - * the index, in such cases. + * do dump any comment for it. (This is safe because dependency ordering + * will have ensured the constraint is emitted first.) Note that the + * emitted comment has to be shown as depending on the constraint, not the + * index, in such cases. */ if (!is_constraint) { @@ -14188,7 +14188,7 @@ findLastBuiltinOid_V71(Archive *fout, const char *dbname) * find the last built in oid * * For 7.0, we do this by assuming that the last thing that initdb does is to - * create the pg_indexes view. This sucks in general, but seeing that 7.0.x + * create the pg_indexes view. This sucks in general, but seeing that 7.0.x * initdb won't be changing anymore, it'll do. */ static Oid @@ -15176,7 +15176,7 @@ getDependencies(Archive *fout) /* * Ordinarily, table rowtypes have implicit dependencies on their - * tables. However, for a composite type the implicit dependency goes + * tables. However, for a composite type the implicit dependency goes * the other way in pg_depend; which is the right thing for DROP but * it doesn't produce the dependency ordering we need. So in that one * case, we reverse the direction of the dependency. @@ -15313,7 +15313,7 @@ addBoundaryDependencies(DumpableObject **dobjs, int numObjs, * chains linking through objects that don't appear explicitly in the dump. * For example, a view will depend on its _RETURN rule while the _RETURN rule * will depend on other objects --- but the rule will not appear as a separate - * object in the dump. We need to adjust the view's dependencies to include + * object in the dump. We need to adjust the view's dependencies to include * whatever the rule depends on that is included in the dump. * * Just to make things more complicated, there are also "special" dependencies diff --git a/src/bin/pg_dump/pg_dump.h b/src/bin/pg_dump/pg_dump.h index e01015eb0a8..daf98bcb54f 100644 --- a/src/bin/pg_dump/pg_dump.h +++ b/src/bin/pg_dump/pg_dump.h @@ -65,10 +65,10 @@ typedef struct SimpleOidList * * NOTE: the structures described here live for the entire pg_dump run; * and in most cases we make a struct for every object we can find in the - * catalogs, not only those we are actually going to dump. Hence, it's + * catalogs, not only those we are actually going to dump. Hence, it's * best to store a minimal amount of per-object info in these structs, * and retrieve additional per-object info when and if we dump a specific - * object. In particular, try to avoid retrieving expensive-to-compute + * object. In particular, try to avoid retrieving expensive-to-compute * information until it's known to be needed. We do, however, have to * store enough info to determine whether an object should be dumped and * what order to dump in. @@ -366,12 +366,12 @@ typedef struct _evttriggerInfo } EventTriggerInfo; /* - * struct ConstraintInfo is used for all constraint types. However we + * struct ConstraintInfo is used for all constraint types. However we * use a different objType for foreign key constraints, to make it easier * to sort them the way we want. * * Note: condeferrable and condeferred are currently only valid for - * unique/primary-key constraints. Otherwise that info is in condef. + * unique/primary-key constraints. Otherwise that info is in condef. */ typedef struct _constraintInfo { diff --git a/src/bin/pg_dump/pg_dump_sort.c b/src/bin/pg_dump/pg_dump_sort.c index 359093214a3..1b505a0fcac 100644 --- a/src/bin/pg_dump/pg_dump_sort.c +++ b/src/bin/pg_dump/pg_dump_sort.c @@ -23,7 +23,7 @@ static const char *modulename = gettext_noop("sorter"); /* * Sort priority for object types when dumping a pre-7.3 database. * Objects are sorted by priority levels, and within an equal priority level - * by OID. (This is a relatively crude hack to provide semi-reasonable + * by OID. (This is a relatively crude hack to provide semi-reasonable * behavior for old databases without full dependency info.) Note: collations, * extensions, text search, foreign-data, materialized view, event trigger, * and default ACL objects can't really happen here, so the rather bogus @@ -387,11 +387,11 @@ sortDumpableObjects(DumpableObject **objs, int numObjs, * TopoSort -- topological sort of a dump list * * Generate a re-ordering of the dump list that satisfies all the dependency - * constraints shown in the dump list. (Each such constraint is a fact of a + * constraints shown in the dump list. (Each such constraint is a fact of a * partial ordering.) Minimize rearrangement of the list not needed to * achieve the partial ordering. * - * The input is the list of numObjs objects in objs[]. This list is not + * The input is the list of numObjs objects in objs[]. This list is not * modified. * * Returns TRUE if able to build an ordering that satisfies all the @@ -434,7 +434,7 @@ TopoSort(DumpableObject **objs, * linked list of items-ready-to-output as Knuth does, we maintain a heap * of their item numbers, which we can use as a priority queue. This * turns the algorithm from O(N) to O(N log N) because each insertion or - * removal of a heap item takes O(log N) time. However, that's still + * removal of a heap item takes O(log N) time. However, that's still * plenty fast enough for this application. */ @@ -492,9 +492,9 @@ TopoSort(DumpableObject **objs, } /*-------------------- - * Now emit objects, working backwards in the output list. At each step, + * Now emit objects, working backwards in the output list. At each step, * we use the priority heap to select the last item that has no remaining - * before-constraints. We remove that item from the heap, output it to + * before-constraints. We remove that item from the heap, output it to * ordering[], and decrease the beforeConstraints count of each of the * items it was constrained against. Whenever an item's beforeConstraints * count is thereby decreased to zero, we insert it into the priority heap @@ -622,7 +622,7 @@ removeHeapElement(int *heap, int heapLength) * before trying TopoSort again. We can safely repair loops that are * disjoint (have no members in common); if we find overlapping loops * then we repair only the first one found, because the action taken to - * repair the first might have repaired the other as well. (If not, + * repair the first might have repaired the other as well. (If not, * we'll fix it on the next go-round.) * * objs[] lists the objects TopoSort couldn't sort @@ -672,7 +672,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. */ @@ -714,7 +714,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]) @@ -772,7 +772,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 @@ -846,7 +846,7 @@ repairViewRuleMultiLoop(DumpableObject *viewobj, /* * If a matview is involved in a multi-object loop, we can't currently fix - * that by splitting off the rule. As a stopgap, we try to fix it by + * that by splitting off the rule. As a stopgap, we try to fix it by * dropping the constraint that the matview be dumped in the pre-data section. * This is sufficient to handle cases where a matview depends on some unique * index, as can happen if it has a GROUP BY for example. @@ -1179,7 +1179,7 @@ repairDependencyLoop(DumpableObject **loop, /* * If all the objects are TABLE_DATA items, what we must have is a * circular set of foreign key constraints (or a single self-referential - * table). Print an appropriate complaint and break the loop arbitrarily. + * table). Print an appropriate complaint and break the loop arbitrarily. */ for (i = 0; i < nLoop; i++) { diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c index 208e49bbcd0..0cc4329b1a1 100644 --- a/src/bin/pg_dump/pg_dumpall.c +++ b/src/bin/pg_dump/pg_dumpall.c @@ -475,9 +475,9 @@ main(int argc, char *argv[]) if (!data_only) { /* - * If asked to --clean, do that first. We can avoid detailed + * If asked to --clean, do that first. We can avoid detailed * dependency analysis because databases never depend on each other, - * and tablespaces never depend on each other. Roles could have + * and tablespaces never depend on each other. Roles could have * grants to each other, but DROP ROLE will clean those up silently. */ if (output_clean) @@ -772,7 +772,7 @@ dumpRoles(PGconn *conn) * will acquire the right properties even if it already exists (ie, it * won't hurt for the CREATE to fail). This is particularly important * for the role we are connected as, since even with --clean we will - * have failed to drop it. binary_upgrade cannot generate any errors, + * have failed to drop it. binary_upgrade cannot generate any errors, * so we assume the current role is already created. */ if (!binary_upgrade || @@ -1202,7 +1202,7 @@ dumpCreateDB(PGconn *conn) * commands for just those databases with values different from defaults. * * We consider template0's encoding and locale (or, pre-7.1, template1's) - * to define the installation default. Pre-8.4 installations do not have + * to define the installation default. Pre-8.4 installations do not have * per-database locale settings; for them, every database must necessarily * be using the installation default, so there's no need to do anything * (which is good, since in very old versions there is no good way to find diff --git a/src/bin/pg_resetxlog/pg_resetxlog.c b/src/bin/pg_resetxlog/pg_resetxlog.c index b5d480e7b80..8671c0a4a3d 100644 --- a/src/bin/pg_resetxlog/pg_resetxlog.c +++ b/src/bin/pg_resetxlog/pg_resetxlog.c @@ -31,7 +31,7 @@ /* * We have to use postgres.h not postgres_fe.h here, because there's so much * backend-only stuff in the XLOG include files we need. But we need a - * frontend-ish environment otherwise. Hence this ugly hack. + * frontend-ish environment otherwise. Hence this ugly hack. */ #define FRONTEND 1 @@ -802,7 +802,7 @@ FindEndOfXLOG(void) /* * Initialize the max() computation using the last checkpoint address from - * old pg_control. Note that for the moment we are working with segment + * old pg_control. Note that for the moment we are working with segment * numbering according to the old xlog seg size. */ segs_per_xlogid = (UINT64CONST(0x0000000100000000) / ControlFile.xlog_seg_size); diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index dabcd680fff..e49cf445b37 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -1048,7 +1048,7 @@ exec_command(const char *cmd, { /* list all variables */ - int i; + int i; static const char *const my_list[] = { "border", "columns", "expanded", "fieldsep", "footer", "format", "linestyle", "null", @@ -1930,17 +1930,17 @@ editFile(const char *fname, int lineno) #ifndef WIN32 if (lineno > 0) sys = psprintf("exec %s %s%d '%s'", - editorName, editor_lineno_arg, lineno, fname); + editorName, editor_lineno_arg, lineno, fname); else sys = psprintf("exec %s '%s'", - editorName, fname); + editorName, fname); #else if (lineno > 0) sys = psprintf("\"%s\" %s%d \"%s\"", - editorName, editor_lineno_arg, lineno, fname); + editorName, editor_lineno_arg, lineno, fname); else sys = psprintf("\"%s\" \"%s\"", - editorName, fname); + editorName, fname); #endif result = system(sys); if (result == -1) @@ -2463,7 +2463,7 @@ printPsetInfo(const char *param, struct printQueryOpt *popt) printf(_("Border style (%s) unset.\n"), param); else printf(_("Border style (%s) is %d.\n"), param, - popt->topt.border); + popt->topt.border); } /* show the target width for the wrapped format */ @@ -2473,7 +2473,7 @@ printPsetInfo(const char *param, struct printQueryOpt *popt) printf(_("Target width (%s) unset.\n"), param); else printf(_("Target width (%s) is %d.\n"), param, - popt->topt.columns); + popt->topt.columns); } /* show expanded/vertical mode */ @@ -2494,7 +2494,7 @@ printPsetInfo(const char *param, struct printQueryOpt *popt) printf(_("Field separator (%s) is zero byte.\n"), param); else printf(_("Field separator (%s) is \"%s\".\n"), param, - popt->topt.fieldSep.separator); + popt->topt.fieldSep.separator); } else if (strcmp(param, "fieldsep_zero") == 0) @@ -2518,21 +2518,21 @@ printPsetInfo(const char *param, struct printQueryOpt *popt) printf(_("Output format (%s) is aligned.\n"), param); else printf(_("Output format (%s) is %s.\n"), param, - _align2string(popt->topt.format)); + _align2string(popt->topt.format)); } /* show table line style */ else if (strcmp(param, "linestyle") == 0) { printf(_("Line style (%s) is %s.\n"), param, - get_line_style(&popt->topt)->name); + get_line_style(&popt->topt)->name); } /* show null display */ else if (strcmp(param, "null") == 0) { printf(_("Null display (%s) is \"%s\".\n"), param, - popt->nullPrint ? popt->nullPrint : ""); + popt->nullPrint ? popt->nullPrint : ""); } /* show locale-aware numeric output */ @@ -2564,7 +2564,7 @@ printPsetInfo(const char *param, struct printQueryOpt *popt) printf(_("Record separator (%s) is <newline>.\n"), param); else printf(_("Record separator (%s) is \"%s\".\n"), param, - popt->topt.recordSep.separator); + popt->topt.recordSep.separator); } else if (strcmp(param, "recordsep_zero") == 0) @@ -2577,7 +2577,7 @@ printPsetInfo(const char *param, struct printQueryOpt *popt) { if (popt->topt.tableAttr) printf(_("Table attribute (%s) is \"%s\".\n"), param, - popt->topt.tableAttr); + popt->topt.tableAttr); else printf(_("Table attributes (%s) unset.\n"), param); } diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 6968adfd42c..60169a2a7df 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -270,7 +270,7 @@ ConnectionUp(void) * see if it can be restored. * * Returns true if either the connection was still there, or it could be - * restored successfully; false otherwise. If, however, there was no + * restored successfully; false otherwise. If, however, there was no * connection and the session is non-interactive, this will exit the program * with a code of EXIT_BADCONN. */ diff --git a/src/bin/psql/copy.c b/src/bin/psql/copy.c index d706206cc96..c759abfc855 100644 --- a/src/bin/psql/copy.c +++ b/src/bin/psql/copy.c @@ -339,7 +339,7 @@ do_copy(const char *args) if (!options->program) { struct stat st; - int result; + int result; /* make sure the specified file is not a directory */ if ((result = fstat(fileno(copystream), &st)) < 0) @@ -628,7 +628,8 @@ handleCopyIn(PGconn *conn, FILE *copystream, bool isbinary, PGresult **res) /* * This code erroneously assumes '\.' on a line alone * inside a quoted CSV string terminates the \copy. - * http://www.postgresql.org/message-id/E1TdNVQ-0001ju-GO@wrigleys.postgresql.org + * http://www.postgresql.org/message-id/E1TdNVQ-0001ju-GO@w + * rigleys.postgresql.org */ if (strcmp(buf, "\\.\n") == 0 || strcmp(buf, "\\.\r\n") == 0) @@ -677,7 +678,7 @@ copyin_cleanup: * COPY FROM STDIN commands. We keep trying PQputCopyEnd() in the hope * it'll work eventually. (What's actually likely to happen is that in * attempting to flush the data, libpq will eventually realize that the - * connection is lost. But that's fine; it will get us out of COPY_IN + * connection is lost. But that's fine; it will get us out of COPY_IN * state, which is what we need.) */ while (*res = PQgetResult(conn), PQresultStatus(*res) == PGRES_COPY_IN) diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index ffdeda8d57d..951b7ee3cd3 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -106,7 +106,7 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem) if (!showSystem && !pattern) appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n" - " AND n.nspname <> 'information_schema'\n"); + " AND n.nspname <> 'information_schema'\n"); processSQLNamePattern(pset.db, &buf, pattern, true, false, "n.nspname", "p.proname", NULL, @@ -449,7 +449,7 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool if (!showSystem && !pattern) appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n" - " AND n.nspname <> 'information_schema'\n"); + " AND n.nspname <> 'information_schema'\n"); appendPQExpBufferStr(&buf, "ORDER BY 1, 2, 4;"); @@ -542,7 +542,7 @@ describeTypes(const char *pattern, bool verbose, bool showSystem) */ appendPQExpBufferStr(&buf, "WHERE (t.typrelid = 0 "); appendPQExpBufferStr(&buf, "OR (SELECT c.relkind = 'c' FROM pg_catalog.pg_class c " - "WHERE c.oid = t.typrelid))\n"); + "WHERE c.oid = t.typrelid))\n"); /* * do not include array types (before 8.3 we have to use the assumption @@ -555,7 +555,7 @@ describeTypes(const char *pattern, bool verbose, bool showSystem) if (!showSystem && !pattern) appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n" - " AND n.nspname <> 'information_schema'\n"); + " AND n.nspname <> 'information_schema'\n"); /* Match name pattern against either internal or external name */ processSQLNamePattern(pset.db, &buf, pattern, true, false, @@ -777,7 +777,7 @@ permissionsList(const char *pattern) appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_class c\n" " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n" - "WHERE c.relkind IN ('r', 'v', 'm', 'S', 'f')\n"); + "WHERE c.relkind IN ('r', 'v', 'm', 'S', 'f')\n"); /* * Unless a schema pattern is specified, we suppress system and temp @@ -958,7 +958,7 @@ objectDescription(const char *pattern, bool showSystem) if (!showSystem && !pattern) appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n" - " AND n.nspname <> 'information_schema'\n"); + " AND n.nspname <> 'information_schema'\n"); processSQLNamePattern(pset.db, &buf, pattern, true, false, "n.nspname", "o.opcname", NULL, @@ -987,7 +987,7 @@ objectDescription(const char *pattern, bool showSystem) if (!showSystem && !pattern) appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n" - " AND n.nspname <> 'information_schema'\n"); + " AND n.nspname <> 'information_schema'\n"); processSQLNamePattern(pset.db, &buf, pattern, true, false, "n.nspname", "opf.opfname", NULL, @@ -1363,8 +1363,8 @@ describeOneTableDetails(const char *schemaname, appendPQExpBufferStr(&buf, ",\n NULL AS indexdef"); if (tableinfo.relkind == 'f' && pset.sversion >= 90200) appendPQExpBufferStr(&buf, ",\n CASE WHEN attfdwoptions IS NULL THEN '' ELSE " - " '(' || array_to_string(ARRAY(SELECT quote_ident(option_name) || ' ' || quote_literal(option_value) FROM " - " pg_options_to_table(attfdwoptions)), ', ') || ')' END AS attfdwoptions"); + " '(' || array_to_string(ARRAY(SELECT quote_ident(option_name) || ' ' || quote_literal(option_value) FROM " + " pg_options_to_table(attfdwoptions)), ', ') || ')' END AS attfdwoptions"); else appendPQExpBufferStr(&buf, ",\n NULL AS attfdwoptions"); if (verbose) @@ -1612,13 +1612,13 @@ describeOneTableDetails(const char *schemaname, if (pset.sversion >= 90000) appendPQExpBufferStr(&buf, " (NOT i.indimmediate) AND " - "EXISTS (SELECT 1 FROM pg_catalog.pg_constraint " + "EXISTS (SELECT 1 FROM pg_catalog.pg_constraint " "WHERE conrelid = i.indrelid AND " "conindid = i.indexrelid AND " "contype IN ('p','u','x') AND " "condeferrable) AS condeferrable,\n" " (NOT i.indimmediate) AND " - "EXISTS (SELECT 1 FROM pg_catalog.pg_constraint " + "EXISTS (SELECT 1 FROM pg_catalog.pg_constraint " "WHERE conrelid = i.indrelid AND " "conindid = i.indexrelid AND " "contype IN ('p','u','x') AND " @@ -1755,11 +1755,11 @@ describeOneTableDetails(const char *schemaname, if (pset.sversion >= 90000) appendPQExpBufferStr(&buf, "pg_catalog.pg_get_constraintdef(con.oid, true), " - "contype, condeferrable, condeferred"); + "contype, condeferrable, condeferred"); else appendPQExpBufferStr(&buf, - "null AS constraintdef, null AS contype, " - "false AS condeferrable, false AS condeferred"); + "null AS constraintdef, null AS contype, " + "false AS condeferrable, false AS condeferred"); if (pset.sversion >= 90400) appendPQExpBufferStr(&buf, ", i.indisreplident"); else @@ -2188,7 +2188,7 @@ describeOneTableDetails(const char *schemaname, printfPQExpBuffer(&buf, _("Disabled triggers:")); break; case 2: - printfPQExpBuffer(&buf, _("Disabled internal triggers:")); + printfPQExpBuffer(&buf, _("Disabled internal triggers:")); break; case 3: printfPQExpBuffer(&buf, _("Triggers firing always:")); @@ -2346,10 +2346,11 @@ describeOneTableDetails(const char *schemaname, } if (verbose && (tableinfo.relkind == 'r' || tableinfo.relkind == 'm') && - /* - * No need to display default values; we already display a - * REPLICA IDENTITY marker on indexes. - */ + + /* + * No need to display default values; we already display a REPLICA + * IDENTITY marker on indexes. + */ tableinfo.relreplident != 'i' && ((strcmp(schemaname, "pg_catalog") != 0 && tableinfo.relreplident != 'd') || (strcmp(schemaname, "pg_catalog") == 0 && tableinfo.relreplident != 'n'))) @@ -2817,7 +2818,7 @@ listTables(const char *tabtypes, const char *pattern, bool verbose, bool showSys if (showForeign) appendPQExpBufferStr(&buf, "'f',"); - appendPQExpBufferStr(&buf, "''"); /* dummy */ + appendPQExpBufferStr(&buf, "''"); /* dummy */ appendPQExpBufferStr(&buf, ")\n"); if (!showSystem && !pattern) @@ -2997,7 +2998,7 @@ listDomains(const char *pattern, bool verbose, bool showSystem) if (verbose) appendPQExpBufferStr(&buf, " LEFT JOIN pg_catalog.pg_description d " - "ON d.classoid = t.tableoid AND d.objoid = t.oid " + "ON d.classoid = t.tableoid AND d.objoid = t.oid " "AND d.objsubid = 0\n"); appendPQExpBufferStr(&buf, "WHERE t.typtype = 'd'\n"); @@ -3039,7 +3040,7 @@ listConversions(const char *pattern, bool verbose, bool showSystem) PGresult *res; printQueryOpt myopt = pset.popt; static const bool translate_columns[] = - {false, false, false, false, true, false}; + {false, false, false, false, true, false}; initPQExpBuffer(&buf); @@ -3078,7 +3079,7 @@ listConversions(const char *pattern, bool verbose, bool showSystem) if (!showSystem && !pattern) appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n" - " AND n.nspname <> 'information_schema'\n"); + " AND n.nspname <> 'information_schema'\n"); processSQLNamePattern(pset.db, &buf, pattern, true, false, "n.nspname", "c.conname", NULL, @@ -3129,7 +3130,7 @@ listEventTriggers(const char *pattern, bool verbose) " when 'D' then '%s' end as \"%s\",\n" " e.evtfoid::pg_catalog.regproc as \"%s\", " "pg_catalog.array_to_string(array(select x" - " from pg_catalog.unnest(evttags) as t(x)), ', ') as \"%s\"", + " from pg_catalog.unnest(evttags) as t(x)), ', ') as \"%s\"", gettext_noop("Name"), gettext_noop("Event"), gettext_noop("Owner"), @@ -3307,11 +3308,11 @@ listCollations(const char *pattern, bool verbose, bool showSystem) appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_collation c, pg_catalog.pg_namespace n\n" - "WHERE n.oid = c.collnamespace\n"); + "WHERE n.oid = c.collnamespace\n"); if (!showSystem && !pattern) appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n" - " AND n.nspname <> 'information_schema'\n"); + " AND n.nspname <> 'information_schema'\n"); /* * Hide collations that aren't usable in the current database's encoding. @@ -4106,7 +4107,7 @@ listForeignServers(const char *pattern, bool verbose) if (verbose) appendPQExpBufferStr(&buf, "LEFT JOIN pg_description d\n " - "ON d.classoid = s.tableoid AND d.objoid = s.oid " + "ON d.classoid = s.tableoid AND d.objoid = s.oid " "AND d.objsubid = 0\n"); processSQLNamePattern(pset.db, &buf, pattern, false, false, @@ -4426,7 +4427,7 @@ listOneExtensionContents(const char *extname, const char *oid) * printACLColumn * * Helper function for consistently formatting ACL (privilege) columns. - * The proper targetlist entry is appended to buf. Note lack of any + * The proper targetlist entry is appended to buf. Note lack of any * whitespace or comma decoration. */ static void diff --git a/src/bin/psql/input.c b/src/bin/psql/input.c index 8351080c01f..aa32a3f5c16 100644 --- a/src/bin/psql/input.c +++ b/src/bin/psql/input.c @@ -38,7 +38,7 @@ static int history_lines_added; * Preserve newlines in saved queries by mapping '\n' to NL_IN_HISTORY * * It is assumed NL_IN_HISTORY will never be entered by the user - * nor appear inside a multi-byte string. 0x00 is not properly + * nor appear inside a multi-byte string. 0x00 is not properly * handled by the readline routines so it can not be used * for this purpose. */ @@ -157,7 +157,7 @@ pg_send_history(PQExpBuffer history_buf) * * Caller *must* have set up sigint_interrupt_jmp before calling. * - * Note: we re-use a static PQExpBuffer for each call. This is to avoid + * Note: we re-use a static PQExpBuffer for each call. This is to avoid * leaking memory if interrupted by SIGINT. */ char * @@ -393,7 +393,7 @@ saveHistory(char *fname, int max_lines, bool appendFlag, bool encodeFlag) /* truncate what we have ... */ if (max_lines >= 0) stifle_history(max_lines); - /* ... and overwrite file. Tough luck for concurrent sessions. */ + /* ... and overwrite file. Tough luck for concurrent sessions. */ errno = 0; (void) write_history(fname); if (errno == 0) diff --git a/src/bin/psql/large_obj.c b/src/bin/psql/large_obj.c index e8ab4bdb4e0..a26ace8b327 100644 --- a/src/bin/psql/large_obj.c +++ b/src/bin/psql/large_obj.c @@ -47,7 +47,7 @@ print_lo_result(const char *fmt,...) /* - * Prepare to do a large-object operation. We *must* be inside a transaction + * Prepare to do a large-object operation. We *must* be inside a transaction * block for all these operations, so start one if needed. * * Returns TRUE if okay, FALSE if failed. *own_transaction is set to indicate diff --git a/src/bin/psql/mainloop.c b/src/bin/psql/mainloop.c index d2b813dd6a9..c3aff208bf1 100644 --- a/src/bin/psql/mainloop.c +++ b/src/bin/psql/mainloop.c @@ -277,7 +277,7 @@ MainLoop(FILE *source) * If we added a newline to query_buf, and nothing else has * been inserted in query_buf by the lexer, then strip off the * newline again. This avoids any change to query_buf when a - * line contains only a backslash command. Also, in this + * line contains only a backslash command. Also, in this * situation we force out any previous lines as a separate * history entry; we don't want SQL and backslash commands * intermixed in history if at all possible. @@ -419,7 +419,7 @@ MainLoop(FILE *source) * psqlscan.c is #include'd here instead of being compiled on its own. * This is because we need postgres_fe.h to be read before any system * include files, else things tend to break on platforms that have - * multiple infrastructures for stdio.h and so on. flex is absolutely + * multiple infrastructures for stdio.h and so on. flex is absolutely * uncooperative about that, so we can't compile psqlscan.c on its own. */ #include "psqlscan.c" diff --git a/src/bin/psql/mbprint.c b/src/bin/psql/mbprint.c index ef3346ff059..470de907354 100644 --- a/src/bin/psql/mbprint.c +++ b/src/bin/psql/mbprint.c @@ -20,7 +20,7 @@ * To avoid version-skew problems, this file must not use declarations * from pg_wchar.h: the encoding IDs we are dealing with are determined * by the libpq.so we are linked with, and that might not match the - * numbers we see at compile time. (If this file were inside libpq, + * numbers we see at compile time. (If this file were inside libpq, * the problem would go away...) * * Hence, we have our own definition of pg_wchar, and we get the values diff --git a/src/bin/psql/print.c b/src/bin/psql/print.c index 08fe907d8d1..62850d8de5e 100644 --- a/src/bin/psql/print.c +++ b/src/bin/psql/print.c @@ -253,7 +253,7 @@ print_separator(struct separator sep, FILE *fout) /* * Return the list of explicitly-requested footers or, when applicable, the - * default "(xx rows)" footer. Always omit the default footer when given + * default "(xx rows)" footer. Always omit the default footer when given * non-default footers, "\pset footer off", or a specific instruction to that * effect from a calling backslash command. Vertical formats number each row, * making the default footer redundant; they do not call this function. @@ -689,7 +689,7 @@ print_aligned_text(const printTableContent *cont, FILE *fout) * Optional optimized word wrap. Shrink columns with a high max/avg * ratio. Slighly bias against wider columns. (Increases chance a * narrow column will fit in its cell.) If available columns is - * positive... and greater than the width of the unshrinkable column + * positive... and greater than the width of the unshrinkable column * headers */ if (output_columns > 0 && output_columns >= total_header_width) @@ -1257,17 +1257,20 @@ print_aligned_vertical(const printTableContent *cont, FILE *fout) if (cont->opt->format == PRINT_WRAPPED) { - /* Calculate the available width to wrap the columns to after + /* + * Calculate the available width to wrap the columns to after * subtracting the maximum header width and separators. At a minimum - * enough to print "[ RECORD N ]" */ - unsigned int width, swidth; + * enough to print "[ RECORD N ]" + */ + unsigned int width, + swidth; if (opt_border == 0) - swidth = 1; /* "header data" */ + swidth = 1; /* "header data" */ else if (opt_border == 1) - swidth = 3; /* "header | data" */ + swidth = 3; /* "header | data" */ else - swidth = 7; /* "| header | data |" */ + swidth = 7; /* "| header | data |" */ /* Wrap to maximum width */ width = dwidth + swidth + hwidth; @@ -1280,13 +1283,14 @@ print_aligned_vertical(const printTableContent *cont, FILE *fout) /* Wrap to minimum width */ if (!opt_tuples_only) { - int delta = 1 + log10(cont->nrows) - width; + int delta = 1 + log10(cont->nrows) - width; + if (opt_border == 0) - delta += 6; /* "* RECORD " */ + delta += 6; /* "* RECORD " */ else if (opt_border == 1) - delta += 10; /* "-[ RECORD ]" */ + delta += 10; /* "-[ RECORD ]" */ else - delta += 15; /* "+-[ RECORD ]-+" */ + delta += 15; /* "+-[ RECORD ]-+" */ if (delta > 0) dwidth += delta; @@ -1333,8 +1337,10 @@ print_aligned_vertical(const printTableContent *cont, FILE *fout) pg_wcsformat((const unsigned char *) *ptr, strlen(*ptr), encoding, dlineptr, dheight); - /* Loop through header and data in parallel dealing with newlines and - * wrapped lines until they're both exhausted */ + /* + * Loop through header and data in parallel dealing with newlines and + * wrapped lines until they're both exhausted + */ dline = hline = 0; dcomplete = hcomplete = 0; offset = 0; @@ -1348,8 +1354,10 @@ print_aligned_vertical(const printTableContent *cont, FILE *fout) /* Header (never wrapped so just need to deal with newlines) */ if (!hcomplete) { - int swidth, twidth = hwidth + 1; - fputs(hline? format->header_nl_left: " ", fout); + int swidth, + twidth = hwidth + 1; + + fputs(hline ? format->header_nl_left : " ", fout); strlen_max_width(hlineptr[hline].ptr, &twidth, encoding); fprintf(fout, "%-s", hlineptr[hline].ptr); @@ -1393,16 +1401,16 @@ print_aligned_vertical(const printTableContent *cont, FILE *fout) /* Data */ if (!dcomplete) { - int target_width, - bytes_to_output, - swidth; + int target_width, + bytes_to_output, + swidth; - fputs(!dcomplete && !offset? " ": format->wrap_left, fout); + fputs(!dcomplete && !offset ? " " : format->wrap_left, fout); target_width = dwidth; bytes_to_output = strlen_max_width(dlineptr[dline].ptr + offset, &target_width, encoding); - fputnbytes(fout, (char *)(dlineptr[dline].ptr + offset), + fputnbytes(fout, (char *) (dlineptr[dline].ptr + offset), bytes_to_output); chars_to_output -= target_width; @@ -1440,8 +1448,10 @@ print_aligned_vertical(const printTableContent *cont, FILE *fout) } else { - /* data exhausted (this can occur if header is longer than the - * data due to newlines in the header) */ + /* + * data exhausted (this can occur if header is longer than the + * data due to newlines in the header) + */ if (opt_border < 2) fputs("\n", fout); else @@ -2510,7 +2520,7 @@ printTableAddCell(printTableContent *const content, char *cell, * strdup'd, so there is no need to keep the original footer string around. * * Footers are never translated by the function. If you want the footer - * translated you must do so yourself, before calling printTableAddFooter. The + * translated you must do so yourself, before calling printTableAddFooter. The * reason this works differently to headers and cells is that footers tend to * be made of up individually translated components, rather than being * translated as a whole. @@ -2846,7 +2856,7 @@ get_line_style(const printTableOpt *opt) /* * Compute the byte distance to the end of the string or *target_width - * display character positions, whichever comes first. Update *target_width + * display character positions, whichever comes first. Update *target_width * to be the number of display character positions actually filled. */ static int diff --git a/src/bin/psql/settings.h b/src/bin/psql/settings.h index eecffb10736..0a60e6817b2 100644 --- a/src/bin/psql/settings.h +++ b/src/bin/psql/settings.h @@ -96,7 +96,7 @@ typedef struct _psqlSettings /* * The remaining fields are set by assign hooks associated with entries in - * "vars". They should not be set directly except by those hook + * "vars". They should not be set directly except by those hook * functions. */ bool autocommit; diff --git a/src/bin/psql/stringutils.c b/src/bin/psql/stringutils.c index 6049ab56c37..9ea3e192158 100644 --- a/src/bin/psql/stringutils.c +++ b/src/bin/psql/stringutils.c @@ -74,7 +74,7 @@ strtokx(const char *s, /* * We may need extra space to insert delimiter nulls for adjacent - * tokens. 2X the space is a gross overestimate, but it's unlikely + * tokens. 2X the space is a gross overestimate, but it's unlikely * that this code will be used on huge strings anyway. */ storage = pg_malloc(2 * strlen(s) + 1); @@ -104,7 +104,7 @@ strtokx(const char *s, { /* * If not at end of string, we need to insert a null to terminate the - * returned token. We can just overwrite the next character if it + * returned token. We can just overwrite the next character if it * happens to be in the whitespace set ... otherwise move over the * rest of the string to make room. (This is why we allocated extra * space above). @@ -158,7 +158,7 @@ strtokx(const char *s, /* * If not at end of string, we need to insert a null to terminate the - * returned token. See notes above. + * returned token. See notes above. */ if (*p != '\0') { @@ -181,7 +181,7 @@ strtokx(const char *s, } /* - * Otherwise no quoting character. Scan till next whitespace, delimiter + * Otherwise no quoting character. Scan till next whitespace, delimiter * or quote. NB: at this point, *start is known not to be '\0', * whitespace, delim, or quote, so we will consume at least one character. */ @@ -207,7 +207,7 @@ strtokx(const char *s, /* * If not at end of string, we need to insert a null to terminate the - * returned token. See notes above. + * returned token. See notes above. */ if (*p != '\0') { @@ -274,7 +274,7 @@ strip_quotes(char *source, char quote, char escape, int encoding) /* * quote_if_needed * - * Opposite of strip_quotes(). If "source" denotes itself literally without + * Opposite of strip_quotes(). If "source" denotes itself literally without * quoting or escaping, returns NULL. Otherwise, returns a malloc'd copy with * quoting and escaping applied: * diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index 6d26ffcd7df..3bb727f05c9 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -86,7 +86,7 @@ typedef struct SchemaQuery /* * Selection condition --- only rows meeting this condition are candidates - * to display. If catname mentions multiple tables, include the necessary + * to display. If catname mentions multiple tables, include the necessary * join condition here. For example, "c.relkind = 'r'". Write NULL (not * an empty string) if not needed. */ @@ -481,7 +481,7 @@ static const SchemaQuery Query_for_list_of_matviews = { * restricted to names matching a partially entered name. In these queries, * the first %s will be replaced by the text entered so far (suitably escaped * to become a SQL literal string). %d will be replaced by the length of the - * string (in unescaped form). A second and third %s, if present, will be + * string (in unescaped form). A second and third %s, if present, will be * replaced by a suitably-escaped version of the string provided in * completion_info_charp. A fourth and fifth %s are similarly replaced by * completion_info_charp2. @@ -942,7 +942,7 @@ psql_completion(const char *text, int start, int end) {"AGGREGATE", "COLLATION", "CONVERSION", "DATABASE", "DEFAULT PRIVILEGES", "DOMAIN", "EVENT TRIGGER", "EXTENSION", "FOREIGN DATA WRAPPER", "FOREIGN TABLE", "FUNCTION", "GROUP", "INDEX", "LANGUAGE", "LARGE OBJECT", "MATERIALIZED VIEW", "OPERATOR", - "ROLE", "RULE", "SCHEMA", "SERVER", "SEQUENCE", "SYSTEM SET", "TABLE", + "ROLE", "RULE", "SCHEMA", "SERVER", "SEQUENCE", "SYSTEM SET", "TABLE", "TABLESPACE", "TEXT SEARCH", "TRIGGER", "TYPE", "USER", "USER MAPPING FOR", "VIEW", NULL}; @@ -1023,7 +1023,7 @@ psql_completion(const char *text, int start, int end) pg_strcasecmp(prev2_wd, "TRIGGER") == 0) { static const char *const list_ALTER_EVENT_TRIGGER[] = - {"DISABLE", "ENABLE", "OWNER TO", "RENAME TO", NULL}; + {"DISABLE", "ENABLE", "OWNER TO", "RENAME TO", NULL}; COMPLETE_WITH_LIST(list_ALTER_EVENT_TRIGGER); } @@ -1035,7 +1035,7 @@ psql_completion(const char *text, int start, int end) pg_strcasecmp(prev_wd, "ENABLE") == 0) { static const char *const list_ALTER_EVENT_TRIGGER_ENABLE[] = - {"REPLICA", "ALWAYS", NULL}; + {"REPLICA", "ALWAYS", NULL}; COMPLETE_WITH_LIST(list_ALTER_EVENT_TRIGGER_ENABLE); } @@ -1385,7 +1385,7 @@ psql_completion(const char *text, int start, int end) static const char *const list_ALTER2[] = {"ADD", "ALTER", "CLUSTER ON", "DISABLE", "DROP", "ENABLE", "INHERIT", "NO INHERIT", "RENAME", "RESET", "OWNER TO", "SET", - "VALIDATE CONSTRAINT", "REPLICA IDENTITY", NULL}; + "VALIDATE CONSTRAINT", "REPLICA IDENTITY", NULL}; COMPLETE_WITH_LIST(list_ALTER2); } @@ -3451,9 +3451,9 @@ psql_completion(const char *text, int start, int end) { static const char *const my_list[] = {"border", "columns", "expanded", "fieldsep", "fieldsep_zero", - "footer", "format", "linestyle", "null", "numericlocale", - "pager", "recordsep", "recordsep_zero", "tableattr", "title", - "tuples_only", NULL}; + "footer", "format", "linestyle", "null", "numericlocale", + "pager", "recordsep", "recordsep_zero", "tableattr", "title", + "tuples_only", NULL}; COMPLETE_WITH_LIST_CS(my_list); } @@ -3721,7 +3721,7 @@ _complete_from_query(int is_schema_query, const char *text, int state) /* * When fetching relation names, suppress system catalogs unless - * the input-so-far begins with "pg_". This is a compromise + * the input-so-far begins with "pg_". This is a compromise * between not offering system catalogs for completion at all, and * having them swamp the result when the input is just "p". */ @@ -4094,7 +4094,7 @@ exec_query(const char *query) /* - * Return the nwords word(s) before point. Words are returned right to left, + * Return the nwords word(s) before point. Words are returned right to left, * that is, previous_words[0] gets the last word before point. * If we run out of words, remaining array elements are set to empty strings. * Each array element is filled with a malloc'd string. diff --git a/src/bin/psql/variables.c b/src/bin/psql/variables.c index 33d79fe9b0c..1f871d7fa01 100644 --- a/src/bin/psql/variables.c +++ b/src/bin/psql/variables.c @@ -15,7 +15,7 @@ * Check whether a variable's name is allowed. * * We allow any non-ASCII character, as well as ASCII letters, digits, and - * underscore. Keep this in sync with the definition of variable_char in + * underscore. Keep this in sync with the definition of variable_char in * psqlscan.l. */ static bool diff --git a/src/bin/scripts/common.c b/src/bin/scripts/common.c index 7a7e8d9fdcc..311fed5090b 100644 --- a/src/bin/scripts/common.c +++ b/src/bin/scripts/common.c @@ -244,7 +244,7 @@ executeMaintenanceCommand(PGconn *conn, const char *query, bool echo) } /* - * Check yes/no answer in a localized way. 1=yes, 0=no, -1=neither. + * Check yes/no answer in a localized way. 1=yes, 0=no, -1=neither. */ /* translator: abbreviation for "yes" */ diff --git a/src/bin/scripts/createuser.c b/src/bin/scripts/createuser.c index 24c4beb2437..2d49bc2f1e8 100644 --- a/src/bin/scripts/createuser.c +++ b/src/bin/scripts/createuser.c @@ -310,6 +310,7 @@ main(int argc, char *argv[]) if (roles.head != NULL) { SimpleStringListCell *cell; + appendPQExpBufferStr(&sql, " IN ROLE "); for (cell = roles.head; cell; cell = cell->next) diff --git a/src/bin/scripts/pg_isready.c b/src/bin/scripts/pg_isready.c index e1fbc544969..7707bf13ea1 100644 --- a/src/bin/scripts/pg_isready.c +++ b/src/bin/scripts/pg_isready.c @@ -41,7 +41,7 @@ main(int argc, char **argv) bool quiet = false; - PGPing rv; + PGPing rv; PQconninfoOption *opts = NULL; PQconninfoOption *defs = NULL; PQconninfoOption *opt; diff --git a/src/bin/scripts/t/010_clusterdb.pl b/src/bin/scripts/t/010_clusterdb.pl index 371b2dd2d3d..fe22cdbb4e4 100644 --- a/src/bin/scripts/t/010_clusterdb.pl +++ b/src/bin/scripts/t/010_clusterdb.pl @@ -10,9 +10,17 @@ program_options_handling_ok('clusterdb'); my $tempdir = tempdir; start_test_server $tempdir; -issues_sql_like(['clusterdb', 'postgres'], qr/statement: CLUSTER;/, 'SQL CLUSTER run'); +issues_sql_like( + [ 'clusterdb', 'postgres' ], + qr/statement: CLUSTER;/, + 'SQL CLUSTER run'); -command_fails(['clusterdb', '-t', 'nonexistent', 'postgres'], 'fails with nonexistent table'); +command_fails([ 'clusterdb', '-t', 'nonexistent', 'postgres' ], + 'fails with nonexistent table'); -psql 'postgres', 'CREATE TABLE test1 (a int); CREATE INDEX test1x ON test1 (a); CLUSTER test1 USING test1x'; -issues_sql_like(['clusterdb', 'postgres', '-t', 'test1'], qr/statement: CLUSTER test1;/, 'cluster specific table'); +psql 'postgres', +'CREATE TABLE test1 (a int); CREATE INDEX test1x ON test1 (a); CLUSTER test1 USING test1x'; +issues_sql_like( + [ 'clusterdb', 'postgres', '-t', 'test1' ], + qr/statement: CLUSTER test1;/, + 'cluster specific table'); diff --git a/src/bin/scripts/t/011_clusterdb_all.pl b/src/bin/scripts/t/011_clusterdb_all.pl index 304c4befa55..eb2016497e3 100644 --- a/src/bin/scripts/t/011_clusterdb_all.pl +++ b/src/bin/scripts/t/011_clusterdb_all.pl @@ -6,4 +6,7 @@ use Test::More tests => 1; my $tempdir = tempdir; start_test_server $tempdir; -issues_sql_like(['clusterdb', '-a'], qr/statement: CLUSTER.*statement: CLUSTER/s, 'cluster all databases'); +issues_sql_like( + [ 'clusterdb', '-a' ], + qr/statement: CLUSTER.*statement: CLUSTER/s, + 'cluster all databases'); diff --git a/src/bin/scripts/t/020_createdb.pl b/src/bin/scripts/t/020_createdb.pl index 8b82a2bd96c..a8e8f3b4d12 100644 --- a/src/bin/scripts/t/020_createdb.pl +++ b/src/bin/scripts/t/020_createdb.pl @@ -10,7 +10,13 @@ program_options_handling_ok('createdb'); my $tempdir = tempdir; start_test_server $tempdir; -issues_sql_like(['createdb', 'foobar1'], qr/statement: CREATE DATABASE foobar1/, 'SQL CREATE DATABASE run'); -issues_sql_like(['createdb', 'foobar2', '-l', 'C', '-E', 'LATIN1', '-T', 'template0'], qr/statement: CREATE DATABASE foobar2 ENCODING 'LATIN1'/, 'create database with encoding'); +issues_sql_like( + [ 'createdb', 'foobar1' ], + qr/statement: CREATE DATABASE foobar1/, + 'SQL CREATE DATABASE run'); +issues_sql_like( + [ 'createdb', 'foobar2', '-l', 'C', '-E', 'LATIN1', '-T', 'template0' ], + qr/statement: CREATE DATABASE foobar2 ENCODING 'LATIN1'/, + 'create database with encoding'); -command_fails(['createdb', 'foobar1'], 'fails if database already exists'); +command_fails([ 'createdb', 'foobar1' ], 'fails if database already exists'); diff --git a/src/bin/scripts/t/030_createlang.pl b/src/bin/scripts/t/030_createlang.pl index 9a87f4c89c6..292021611b6 100644 --- a/src/bin/scripts/t/030_createlang.pl +++ b/src/bin/scripts/t/030_createlang.pl @@ -10,9 +10,15 @@ program_options_handling_ok('createlang'); my $tempdir = tempdir; start_test_server $tempdir; -command_fails(['createlang', 'plpgsql', 'postgres'], 'fails if language already exists'); +command_fails( + [ 'createlang', 'plpgsql', 'postgres' ], + 'fails if language already exists'); psql 'postgres', 'DROP EXTENSION plpgsql'; -issues_sql_like(['createlang', 'plpgsql', 'postgres'], qr/statement: CREATE EXTENSION "plpgsql"/, 'SQL CREATE EXTENSION run'); +issues_sql_like( + [ 'createlang', 'plpgsql', 'postgres' ], + qr/statement: CREATE EXTENSION "plpgsql"/, + 'SQL CREATE EXTENSION run'); -command_like(['createlang', '--list', 'postgres'], qr/plpgsql/, 'list output'); +command_like([ 'createlang', '--list', 'postgres' ], + qr/plpgsql/, 'list output'); diff --git a/src/bin/scripts/t/040_createuser.pl b/src/bin/scripts/t/040_createuser.pl index 922873ab374..8837c2b6e99 100644 --- a/src/bin/scripts/t/040_createuser.pl +++ b/src/bin/scripts/t/040_createuser.pl @@ -10,17 +10,21 @@ program_options_handling_ok('createuser'); my $tempdir = tempdir; start_test_server $tempdir; -issues_sql_like(['createuser', 'user1'], - qr/statement: CREATE ROLE user1 NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;/, - 'SQL CREATE USER run'); -issues_sql_like(['createuser', '-L', 'role1'], - qr/statement: CREATE ROLE role1 NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT NOLOGIN;/, - 'create a non-login role'); -issues_sql_like(['createuser', '-r', 'user2'], - qr/statement: CREATE ROLE user2 NOSUPERUSER NOCREATEDB CREATEROLE INHERIT LOGIN;/, - 'create a CREATEROLE user'); -issues_sql_like(['createuser', '-s', 'user3'], - qr/statement: CREATE ROLE user3 SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;/, - 'create a superuser'); +issues_sql_like( + [ 'createuser', 'user1' ], +qr/statement: CREATE ROLE user1 NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;/, + 'SQL CREATE USER run'); +issues_sql_like( + [ 'createuser', '-L', 'role1' ], +qr/statement: CREATE ROLE role1 NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT NOLOGIN;/, + 'create a non-login role'); +issues_sql_like( + [ 'createuser', '-r', 'user2' ], +qr/statement: CREATE ROLE user2 NOSUPERUSER NOCREATEDB CREATEROLE INHERIT LOGIN;/, + 'create a CREATEROLE user'); +issues_sql_like( + [ 'createuser', '-s', 'user3' ], +qr/statement: CREATE ROLE user3 SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;/, + 'create a superuser'); -command_fails(['createuser', 'user1'], 'fails if role already exists'); +command_fails([ 'createuser', 'user1' ], 'fails if role already exists'); diff --git a/src/bin/scripts/t/050_dropdb.pl b/src/bin/scripts/t/050_dropdb.pl index 3662dd01c1d..04a8789d887 100644 --- a/src/bin/scripts/t/050_dropdb.pl +++ b/src/bin/scripts/t/050_dropdb.pl @@ -11,6 +11,9 @@ my $tempdir = tempdir; start_test_server $tempdir; psql 'postgres', 'CREATE DATABASE foobar1'; -issues_sql_like(['dropdb', 'foobar1'], qr/statement: DROP DATABASE foobar1/, 'SQL DROP DATABASE run'); +issues_sql_like( + [ 'dropdb', 'foobar1' ], + qr/statement: DROP DATABASE foobar1/, + 'SQL DROP DATABASE run'); -command_fails(['dropdb', 'nonexistent'], 'fails with nonexistent database'); +command_fails([ 'dropdb', 'nonexistent' ], 'fails with nonexistent database'); diff --git a/src/bin/scripts/t/060_droplang.pl b/src/bin/scripts/t/060_droplang.pl index 47cb48f1171..09fb2f3b077 100644 --- a/src/bin/scripts/t/060_droplang.pl +++ b/src/bin/scripts/t/060_droplang.pl @@ -10,6 +10,11 @@ program_options_handling_ok('droplang'); my $tempdir = tempdir; start_test_server $tempdir; -issues_sql_like(['droplang', 'plpgsql', 'postgres'], qr/statement: DROP EXTENSION "plpgsql"/, 'SQL DROP EXTENSION run'); +issues_sql_like( + [ 'droplang', 'plpgsql', 'postgres' ], + qr/statement: DROP EXTENSION "plpgsql"/, + 'SQL DROP EXTENSION run'); -command_fails(['droplang', 'nonexistent', 'postgres'], 'fails with nonexistent language'); +command_fails( + [ 'droplang', 'nonexistent', 'postgres' ], + 'fails with nonexistent language'); diff --git a/src/bin/scripts/t/070_dropuser.pl b/src/bin/scripts/t/070_dropuser.pl index 495636ae846..9e0587d68f9 100644 --- a/src/bin/scripts/t/070_dropuser.pl +++ b/src/bin/scripts/t/070_dropuser.pl @@ -11,6 +11,9 @@ my $tempdir = tempdir; start_test_server $tempdir; psql 'postgres', 'CREATE ROLE foobar1'; -issues_sql_like(['dropuser', 'foobar1'], qr/statement: DROP ROLE foobar1/, 'SQL DROP ROLE run'); +issues_sql_like( + [ 'dropuser', 'foobar1' ], + qr/statement: DROP ROLE foobar1/, + 'SQL DROP ROLE run'); -command_fails(['dropuser', 'nonexistent'], 'fails with nonexistent user'); +command_fails([ 'dropuser', 'nonexistent' ], 'fails with nonexistent user'); diff --git a/src/bin/scripts/t/090_reindexdb.pl b/src/bin/scripts/t/090_reindexdb.pl index 18756e86aac..24b927ce223 100644 --- a/src/bin/scripts/t/090_reindexdb.pl +++ b/src/bin/scripts/t/090_reindexdb.pl @@ -12,10 +12,23 @@ start_test_server $tempdir; $ENV{PGOPTIONS} = '--client-min-messages=WARNING'; -issues_sql_like(['reindexdb', 'postgres'], qr/statement: REINDEX DATABASE postgres;/, 'SQL REINDEX run'); +issues_sql_like( + [ 'reindexdb', 'postgres' ], + qr/statement: REINDEX DATABASE postgres;/, + 'SQL REINDEX run'); -psql 'postgres', 'CREATE TABLE test1 (a int); CREATE INDEX test1x ON test1 (a);'; -issues_sql_like(['reindexdb', 'postgres', '-t', 'test1'], qr/statement: REINDEX TABLE test1;/, 'reindex specific table'); -issues_sql_like(['reindexdb', 'postgres', '-i', 'test1x'], qr/statement: REINDEX INDEX test1x;/, 'reindex specific index'); +psql 'postgres', + 'CREATE TABLE test1 (a int); CREATE INDEX test1x ON test1 (a);'; +issues_sql_like( + [ 'reindexdb', 'postgres', '-t', 'test1' ], + qr/statement: REINDEX TABLE test1;/, + 'reindex specific table'); +issues_sql_like( + [ 'reindexdb', 'postgres', '-i', 'test1x' ], + qr/statement: REINDEX INDEX test1x;/, + 'reindex specific index'); -issues_sql_like(['reindexdb', 'postgres', '-s'], qr/statement: REINDEX SYSTEM postgres;/, 'reindex system tables'); +issues_sql_like( + [ 'reindexdb', 'postgres', '-s' ], + qr/statement: REINDEX SYSTEM postgres;/, + 'reindex system tables'); diff --git a/src/bin/scripts/t/091_reindexdb_all.pl b/src/bin/scripts/t/091_reindexdb_all.pl index eee8ba8ed9c..6c5c59e7492 100644 --- a/src/bin/scripts/t/091_reindexdb_all.pl +++ b/src/bin/scripts/t/091_reindexdb_all.pl @@ -8,4 +8,7 @@ start_test_server $tempdir; $ENV{PGOPTIONS} = '--client-min-messages=WARNING'; -issues_sql_like(['reindexdb', '-a'], qr/statement: REINDEX.*statement: REINDEX/s, 'reindex all databases'); +issues_sql_like( + [ 'reindexdb', '-a' ], + qr/statement: REINDEX.*statement: REINDEX/s, + 'reindex all databases'); diff --git a/src/bin/scripts/t/100_vacuumdb.pl b/src/bin/scripts/t/100_vacuumdb.pl index 39f1cec8a14..78a40fa791a 100644 --- a/src/bin/scripts/t/100_vacuumdb.pl +++ b/src/bin/scripts/t/100_vacuumdb.pl @@ -10,8 +10,23 @@ program_options_handling_ok('vacuumdb'); my $tempdir = tempdir; start_test_server $tempdir; -issues_sql_like(['vacuumdb', 'postgres'], qr/statement: VACUUM;/, 'SQL VACUUM run'); -issues_sql_like(['vacuumdb', '-f', 'postgres'], qr/statement: VACUUM \(FULL\);/, 'vacuumdb -f'); -issues_sql_like(['vacuumdb', '-F', 'postgres'], qr/statement: VACUUM \(FREEZE\);/, 'vacuumdb -F'); -issues_sql_like(['vacuumdb', '-z', 'postgres'], qr/statement: VACUUM \(ANALYZE\);/, 'vacuumdb -z'); -issues_sql_like(['vacuumdb', '-Z', 'postgres'], qr/statement: ANALYZE;/, 'vacuumdb -z'); +issues_sql_like( + [ 'vacuumdb', 'postgres' ], + qr/statement: VACUUM;/, + 'SQL VACUUM run'); +issues_sql_like( + [ 'vacuumdb', '-f', 'postgres' ], + qr/statement: VACUUM \(FULL\);/, + 'vacuumdb -f'); +issues_sql_like( + [ 'vacuumdb', '-F', 'postgres' ], + qr/statement: VACUUM \(FREEZE\);/, + 'vacuumdb -F'); +issues_sql_like( + [ 'vacuumdb', '-z', 'postgres' ], + qr/statement: VACUUM \(ANALYZE\);/, + 'vacuumdb -z'); +issues_sql_like( + [ 'vacuumdb', '-Z', 'postgres' ], + qr/statement: ANALYZE;/, + 'vacuumdb -z'); diff --git a/src/bin/scripts/t/101_vacuumdb_all.pl b/src/bin/scripts/t/101_vacuumdb_all.pl index b5779bcf12c..f2120e0bff3 100644 --- a/src/bin/scripts/t/101_vacuumdb_all.pl +++ b/src/bin/scripts/t/101_vacuumdb_all.pl @@ -6,4 +6,7 @@ use Test::More tests => 1; my $tempdir = tempdir; start_test_server $tempdir; -issues_sql_like(['vacuumdb', '-a'], qr/statement: VACUUM.*statement: VACUUM/s, 'vacuum all databases'); +issues_sql_like( + [ 'vacuumdb', '-a' ], + qr/statement: VACUUM.*statement: VACUUM/s, + 'vacuum all databases'); diff --git a/src/bin/scripts/t/102_vacuumdb_stages.pl b/src/bin/scripts/t/102_vacuumdb_stages.pl index 743743edba5..4b032d3abac 100644 --- a/src/bin/scripts/t/102_vacuumdb_stages.pl +++ b/src/bin/scripts/t/102_vacuumdb_stages.pl @@ -6,11 +6,12 @@ use Test::More tests => 1; my $tempdir = tempdir; start_test_server $tempdir; -issues_sql_like(['vacuumdb', '--analyze-in-stages', 'postgres'], - qr/.*statement:\ SET\ default_statistics_target=1;\ SET\ vacuum_cost_delay=0; +issues_sql_like( + [ 'vacuumdb', '--analyze-in-stages', 'postgres' ], +qr/.*statement:\ SET\ default_statistics_target=1;\ SET\ vacuum_cost_delay=0; .*statement:\ ANALYZE.* .*statement:\ SET\ default_statistics_target=10;\ RESET\ vacuum_cost_delay; .*statement:\ ANALYZE.* .*statement:\ RESET\ default_statistics_target; .*statement:\ ANALYZE/sx, - 'analyze three times'); + 'analyze three times'); diff --git a/src/bin/scripts/vacuumdb.c b/src/bin/scripts/vacuumdb.c index 1e288ef978c..0cfe5b0bc95 100644 --- a/src/bin/scripts/vacuumdb.c +++ b/src/bin/scripts/vacuumdb.c @@ -16,7 +16,7 @@ static void vacuum_one_database(const char *dbname, bool full, bool verbose, - bool and_analyze, bool analyze_only, bool analyze_in_stages, bool freeze, + bool and_analyze, bool analyze_only, bool analyze_in_stages, bool freeze, const char *table, const char *host, const char *port, const char *username, enum trivalue prompt_password, const char *progname, bool echo); @@ -254,7 +254,7 @@ run_vacuum_command(PGconn *conn, const char *sql, bool echo, const char *dbname, static void vacuum_one_database(const char *dbname, bool full, bool verbose, bool and_analyze, - bool analyze_only, bool analyze_in_stages, bool freeze, const char *table, + bool analyze_only, bool analyze_in_stages, bool freeze, const char *table, const char *host, const char *port, const char *username, enum trivalue prompt_password, const char *progname, bool echo) @@ -334,7 +334,7 @@ vacuum_one_database(const char *dbname, bool full, bool verbose, bool and_analyz gettext_noop("Generating medium optimizer statistics (10 targets)"), gettext_noop("Generating default (full) optimizer statistics") }; - int i; + int i; for (i = 0; i < 3; i++) { @@ -353,7 +353,7 @@ vacuum_one_database(const char *dbname, bool full, bool verbose, bool and_analyz static void vacuum_all_databases(bool full, bool verbose, bool and_analyze, bool analyze_only, - bool analyze_in_stages, bool freeze, const char *maintenance_db, + bool analyze_in_stages, bool freeze, const char *maintenance_db, const char *host, const char *port, const char *username, enum trivalue prompt_password, const char *progname, bool echo, bool quiet) @@ -406,7 +406,7 @@ help(const char *progname) printf(_(" -z, --analyze update optimizer statistics\n")); printf(_(" -Z, --analyze-only only update optimizer statistics\n")); printf(_(" --analyze-in-stages only update optimizer statistics, in multiple\n" - " stages for faster results\n")); + " stages for faster results\n")); printf(_(" -?, --help show this help, then exit\n")); printf(_("\nConnection options:\n")); printf(_(" -h, --host=HOSTNAME database server host or socket directory\n")); |