PostgreSQL Source Code  git master
option.c File Reference
#include "postgres_fe.h"
#include <time.h>
#include "common/string.h"
#include "getopt_long.h"
#include "pg_upgrade.h"
#include "utils/pidfile.h"
Include dependency graph for option.c:

Go to the source code of this file.

Macros

#define FIX_DEFAULT_READ_ONLY   "-c default_transaction_read_only=false"
 

Functions

static void usage (void)
 
static void check_required_directory (char **dirpath, const char *envVarName, bool useCwd, const char *cmdLineOption, const char *description, bool missingOk)
 
void parseCommandLine (int argc, char *argv[])
 
void adjust_data_dir (ClusterInfo *cluster)
 
void get_sock_dir (ClusterInfo *cluster, bool live_check)
 

Variables

UserOpts user_opts
 

Macro Definition Documentation

◆ FIX_DEFAULT_READ_ONLY

#define FIX_DEFAULT_READ_ONLY   "-c default_transaction_read_only=false"

Definition at line 27 of file option.c.

Referenced by parseCommandLine().

Function Documentation

◆ adjust_data_dir()

void adjust_data_dir ( ClusterInfo cluster)

Definition at line 411 of file option.c.

References ClusterInfo::bindir, check_ok(), filename, MAX_STRING, MAXPGPATH, old_cluster, output(), pg_fatal, pg_strdup(), pg_strip_crlf(), ClusterInfo::pgconfig, ClusterInfo::pgdata, prep_status(), snprintf, and strerror.

412 {
413  char filename[MAXPGPATH];
414  char cmd[MAXPGPATH],
415  cmd_output[MAX_STRING];
416  FILE *fp,
417  *output;
418 
419  /* Initially assume config dir and data dir are the same */
420  cluster->pgconfig = pg_strdup(cluster->pgdata);
421 
422  /* If there is no postgresql.conf, it can't be a config-only dir */
423  snprintf(filename, sizeof(filename), "%s/postgresql.conf", cluster->pgconfig);
424  if ((fp = fopen(filename, "r")) == NULL)
425  return;
426  fclose(fp);
427 
428  /* If PG_VERSION exists, it can't be a config-only dir */
429  snprintf(filename, sizeof(filename), "%s/PG_VERSION", cluster->pgconfig);
430  if ((fp = fopen(filename, "r")) != NULL)
431  {
432  fclose(fp);
433  return;
434  }
435 
436  /* Must be a configuration directory, so find the real data directory. */
437 
438  if (cluster == &old_cluster)
439  prep_status("Finding the real data directory for the source cluster");
440  else
441  prep_status("Finding the real data directory for the target cluster");
442 
443  /*
444  * We don't have a data directory yet, so we can't check the PG version,
445  * so this might fail --- only works for PG 9.2+. If this fails,
446  * pg_upgrade will fail anyway because the data files will not be found.
447  */
448  snprintf(cmd, sizeof(cmd), "\"%s/postgres\" -D \"%s\" -C data_directory",
449  cluster->bindir, cluster->pgconfig);
450 
451  if ((output = popen(cmd, "r")) == NULL ||
452  fgets(cmd_output, sizeof(cmd_output), output) == NULL)
453  pg_fatal("could not get data directory using %s: %s\n",
454  cmd, strerror(errno));
455 
456  pclose(output);
457 
458  /* strip trailing newline and carriage return */
459  (void) pg_strip_crlf(cmd_output);
460 
461  cluster->pgdata = pg_strdup(cmd_output);
462 
463  check_ok();
464 }
int pg_strip_crlf(char *str)
Definition: string.c:121
static void output(uint64 loop_count)
#define pg_fatal(...)
Definition: pg_rewind.h:37
char * pgconfig
Definition: pg_upgrade.h:260
#define MAXPGPATH
void prep_status(const char *fmt,...) pg_attribute_printf(1
ClusterInfo old_cluster
Definition: pg_upgrade.c:59
char * pg_strdup(const char *in)
Definition: fe_memutils.c:85
static void check_ok(void)
Definition: initdb.c:1991
char * bindir
Definition: pg_upgrade.h:262
#define MAX_STRING
Definition: pg_upgrade.h:18
#define strerror
Definition: port.h:229
static char * filename
Definition: pg_dumpall.c:91
char * pgdata
Definition: pg_upgrade.h:259
#define snprintf
Definition: port.h:216

◆ check_required_directory()

static void check_required_directory ( char **  dirpath,
const char *  envVarName,
bool  useCwd,
const char *  cmdLineOption,
const char *  description,
bool  missingOk 
)
static

Definition at line 366 of file option.c.

References canonicalize_path(), MAXPGPATH, pg_fatal, and pg_strdup().

Referenced by parseCommandLine().

369 {
370  if (*dirpath == NULL || strlen(*dirpath) == 0)
371  {
372  const char *envVar;
373 
374  if ((envVar = getenv(envVarName)) && strlen(envVar))
375  *dirpath = pg_strdup(envVar);
376  else if (useCwd)
377  {
378  char cwd[MAXPGPATH];
379 
380  if (!getcwd(cwd, MAXPGPATH))
381  pg_fatal("could not determine current directory\n");
382  *dirpath = pg_strdup(cwd);
383  }
384  else if (missingOk)
385  return;
386  else
387  pg_fatal("You must identify the directory where the %s.\n"
388  "Please use the %s command-line option or the %s environment variable.\n",
389  description, cmdLineOption, envVarName);
390  }
391 
392  /*
393  * Clean up the path, in particular trimming any trailing path separators,
394  * because we construct paths by appending to this path.
395  */
396  canonicalize_path(*dirpath);
397 }
void canonicalize_path(char *path)
Definition: path.c:254
#define pg_fatal(...)
Definition: pg_rewind.h:37
#define MAXPGPATH
char * pg_strdup(const char *in)
Definition: fe_memutils.c:85

◆ get_sock_dir()

void get_sock_dir ( ClusterInfo cluster,
bool  live_check 
)

Definition at line 476 of file option.c.

References DEF_PGUPORT, filename, GET_MAJOR_VERSION, LOCK_FILE_LINE_PORT, LOCK_FILE_LINE_SOCKET_DIR, ClusterInfo::major_version, Max, MAXPGPATH, old_cluster, pg_fatal, pg_log(), pg_strdup(), pg_strip_crlf(), PG_WARNING, ClusterInfo::pgdata, ClusterInfo::port, snprintf, ClusterInfo::sockdir, UserOpts::socketdir, and strerror.

Referenced by main().

477 {
478 #if defined(HAVE_UNIX_SOCKETS) && !defined(WIN32)
479 
480  /*
481  * sockdir and port were added to postmaster.pid in PG 9.1. Pre-9.1 cannot
482  * process pg_ctl -w for sockets in non-default locations.
483  */
484  if (GET_MAJOR_VERSION(cluster->major_version) >= 901)
485  {
486  if (!live_check)
487  cluster->sockdir = user_opts.socketdir;
488  else
489  {
490  /*
491  * If we are doing a live check, we will use the old cluster's
492  * Unix domain socket directory so we can connect to the live
493  * server.
494  */
495  unsigned short orig_port = cluster->port;
496  char filename[MAXPGPATH],
497  line[MAXPGPATH];
498  FILE *fp;
499  int lineno;
500 
501  snprintf(filename, sizeof(filename), "%s/postmaster.pid",
502  cluster->pgdata);
503  if ((fp = fopen(filename, "r")) == NULL)
504  pg_fatal("could not open file \"%s\": %s\n",
505  filename, strerror(errno));
506 
507  for (lineno = 1;
509  lineno++)
510  {
511  if (fgets(line, sizeof(line), fp) == NULL)
512  pg_fatal("could not read line %d from file \"%s\": %s\n",
513  lineno, filename, strerror(errno));
514 
515  /* potentially overwrite user-supplied value */
516  if (lineno == LOCK_FILE_LINE_PORT)
517  sscanf(line, "%hu", &old_cluster.port);
518  if (lineno == LOCK_FILE_LINE_SOCKET_DIR)
519  {
520  /* strip trailing newline and carriage return */
521  cluster->sockdir = pg_strdup(line);
522  (void) pg_strip_crlf(cluster->sockdir);
523  }
524  }
525  fclose(fp);
526 
527  /* warn of port number correction */
528  if (orig_port != DEF_PGUPORT && old_cluster.port != orig_port)
529  pg_log(PG_WARNING, "user-supplied old port number %hu corrected to %hu\n",
530  orig_port, cluster->port);
531  }
532  }
533  else
534 
535  /*
536  * Can't get sockdir and pg_ctl -w can't use a non-default, use
537  * default
538  */
539  cluster->sockdir = NULL;
540 #else /* !HAVE_UNIX_SOCKETS || WIN32 */
541  cluster->sockdir = NULL;
542 #endif
543 }
uint32 major_version
Definition: pg_upgrade.h:267
int pg_strip_crlf(char *str)
Definition: string.c:121
#define GET_MAJOR_VERSION(v)
Definition: pg_upgrade.h:23
#define pg_fatal(...)
Definition: pg_rewind.h:37
unsigned short port
Definition: pg_upgrade.h:266
#define LOCK_FILE_LINE_SOCKET_DIR
Definition: pidfile.h:41
#define MAXPGPATH
ClusterInfo old_cluster
Definition: pg_upgrade.c:59
char * pg_strdup(const char *in)
Definition: fe_memutils.c:85
UserOpts user_opts
Definition: option.c:30
#define DEF_PGUPORT
Definition: pg_upgrade.h:16
void void pg_log(eLogType type, const char *fmt,...) pg_attribute_printf(2
#define Max(x, y)
Definition: c.h:980
#define LOCK_FILE_LINE_PORT
Definition: pidfile.h:40
#define strerror
Definition: port.h:229
static char * filename
Definition: pg_dumpall.c:91
char * pgdata
Definition: pg_upgrade.h:259
char * sockdir
Definition: pg_upgrade.h:265
#define snprintf
Definition: port.h:216
char * socketdir
Definition: pg_upgrade.h:294

◆ parseCommandLine()

void parseCommandLine ( int  argc,
char *  argv[] 
)

Definition at line 39 of file option.c.

References _, ClusterInfo::bindir, canonicalize_path(), UserOpts::check, check_required_directory(), DEF_PGUPORT, filename, FIX_DEFAULT_READ_ONLY, fopen_priv, fprintf, free, get_progname(), get_user_info(), getopt_long(), UserOpts::ind_coll_unknown, LogOpts::internal, INTERNAL_LOG_FILE, UserOpts::jobs, log_opts, MAXPGPATH, new_cluster, no_argument, old_cluster, optarg, optind, os_info, output_files, path_is_prefix_of_path(), pfree(), pg_fatal, pg_free(), pg_log(), PG_REPORT, pg_strdup(), ClusterInfo::pgdata, ClusterInfo::pgopts, ClusterInfo::port, OSInfo::progname, psprintf(), required_argument, LogOpts::retain, setenv, UserOpts::socketdir, strlcpy(), UserOpts::transfer_mode, TRANSFER_MODE_CLONE, TRANSFER_MODE_COPY, TRANSFER_MODE_LINK, usage(), OSInfo::user, OSInfo::user_specified, and LogOpts::verbose.

Referenced by main().

40 {
41  static struct option long_options[] = {
42  {"old-datadir", required_argument, NULL, 'd'},
43  {"new-datadir", required_argument, NULL, 'D'},
44  {"old-bindir", required_argument, NULL, 'b'},
45  {"new-bindir", required_argument, NULL, 'B'},
46  {"old-options", required_argument, NULL, 'o'},
47  {"new-options", required_argument, NULL, 'O'},
48  {"old-port", required_argument, NULL, 'p'},
49  {"new-port", required_argument, NULL, 'P'},
50 
51  {"username", required_argument, NULL, 'U'},
52  {"check", no_argument, NULL, 'c'},
53  {"link", no_argument, NULL, 'k'},
54  {"retain", no_argument, NULL, 'r'},
55  {"jobs", required_argument, NULL, 'j'},
56  {"socketdir", required_argument, NULL, 's'},
57  {"verbose", no_argument, NULL, 'v'},
58  {"clone", no_argument, NULL, 1},
59  {"index-collation-versions-unknown", no_argument, NULL, 2},
60 
61  {NULL, 0, NULL, 0}
62  };
63  int option; /* Command line option */
64  int optindex = 0; /* used by getopt_long */
65  int os_user_effective_id;
66  FILE *fp;
67  char **filename;
68  time_t run_time = time(NULL);
69 
71 
72  os_info.progname = get_progname(argv[0]);
73 
74  /* Process libpq env. variables; load values here for usage() output */
75  old_cluster.port = getenv("PGPORTOLD") ? atoi(getenv("PGPORTOLD")) : DEF_PGUPORT;
76  new_cluster.port = getenv("PGPORTNEW") ? atoi(getenv("PGPORTNEW")) : DEF_PGUPORT;
77 
78  os_user_effective_id = get_user_info(&os_info.user);
79  /* we override just the database user name; we got the OS id above */
80  if (getenv("PGUSER"))
81  {
83  /* must save value, getenv()'s pointer is not stable */
84  os_info.user = pg_strdup(getenv("PGUSER"));
85  }
86 
87  if (argc > 1)
88  {
89  if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") == 0)
90  {
91  usage();
92  exit(0);
93  }
94  if (strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-V") == 0)
95  {
96  puts("pg_upgrade (PostgreSQL) " PG_VERSION);
97  exit(0);
98  }
99  }
100 
101  /* Allow help and version to be run as root, so do the test here. */
102  if (os_user_effective_id == 0)
103  pg_fatal("%s: cannot be run as root\n", os_info.progname);
104 
105  while ((option = getopt_long(argc, argv, "d:D:b:B:cj:ko:O:p:P:rs:U:v",
106  long_options, &optindex)) != -1)
107  {
108  switch (option)
109  {
110  case 'b':
112  break;
113 
114  case 'B':
116  break;
117 
118  case 'c':
119  user_opts.check = true;
120  break;
121 
122  case 'd':
124  break;
125 
126  case 'D':
128  break;
129 
130  case 'j':
131  user_opts.jobs = atoi(optarg);
132  break;
133 
134  case 'k':
136  break;
137 
138  case 'o':
139  /* append option? */
140  if (!old_cluster.pgopts)
142  else
143  {
144  char *old_pgopts = old_cluster.pgopts;
145 
146  old_cluster.pgopts = psprintf("%s %s", old_pgopts, optarg);
147  free(old_pgopts);
148  }
149  break;
150 
151  case 'O':
152  /* append option? */
153  if (!new_cluster.pgopts)
155  else
156  {
157  char *new_pgopts = new_cluster.pgopts;
158 
159  new_cluster.pgopts = psprintf("%s %s", new_pgopts, optarg);
160  free(new_pgopts);
161  }
162  break;
163 
164  /*
165  * Someday, the port number option could be removed and passed
166  * using -o/-O, but that requires postmaster -C to be
167  * supported on all old/new versions (added in PG 9.2).
168  */
169  case 'p':
170  if ((old_cluster.port = atoi(optarg)) <= 0)
171  pg_fatal("invalid old port number\n");
172  break;
173 
174  case 'P':
175  if ((new_cluster.port = atoi(optarg)) <= 0)
176  pg_fatal("invalid new port number\n");
177  break;
178 
179  case 'r':
180  log_opts.retain = true;
181  break;
182 
183  case 's':
185  break;
186 
187  case 'U':
190  os_info.user_specified = true;
191 
192  /*
193  * Push the user name into the environment so pre-9.1
194  * pg_ctl/libpq uses it.
195  */
196  setenv("PGUSER", os_info.user, 1);
197  break;
198 
199  case 'v':
200  log_opts.verbose = true;
201  break;
202 
203  case 1:
205  break;
206 
207  case 2:
209  break;
210 
211  default:
212  fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
213  os_info.progname);
214  exit(1);
215  }
216  }
217 
218  if (optind < argc)
219  pg_fatal("too many command-line arguments (first is \"%s\")\n", argv[optind]);
220 
221  if ((log_opts.internal = fopen_priv(INTERNAL_LOG_FILE, "a")) == NULL)
222  pg_fatal("could not open log file \"%s\": %m\n", INTERNAL_LOG_FILE);
223 
224  if (log_opts.verbose)
225  pg_log(PG_REPORT, "Running in verbose mode\n");
226 
227  /* label start of upgrade in logfiles */
228  for (filename = output_files; *filename != NULL; filename++)
229  {
230  if ((fp = fopen_priv(*filename, "a")) == NULL)
231  pg_fatal("could not write to log file \"%s\": %m\n", *filename);
232 
233  /* Start with newline because we might be appending to a file. */
234  fprintf(fp, "\n"
235  "-----------------------------------------------------------------\n"
236  " pg_upgrade run on %s"
237  "-----------------------------------------------------------------\n\n",
238  ctime(&run_time));
239  fclose(fp);
240  }
241 
242  /* Turn off read-only mode; add prefix to PGOPTIONS? */
243  if (getenv("PGOPTIONS"))
244  {
245  char *pgoptions = psprintf("%s %s", FIX_DEFAULT_READ_ONLY,
246  getenv("PGOPTIONS"));
247 
248  setenv("PGOPTIONS", pgoptions, 1);
249  pfree(pgoptions);
250  }
251  else
252  setenv("PGOPTIONS", FIX_DEFAULT_READ_ONLY, 1);
253 
254  /* Get values from env if not already set */
255  check_required_directory(&old_cluster.bindir, "PGBINOLD", false,
256  "-b", _("old cluster binaries reside"), false);
257  check_required_directory(&new_cluster.bindir, "PGBINNEW", false,
258  "-B", _("new cluster binaries reside"), true);
259  check_required_directory(&old_cluster.pgdata, "PGDATAOLD", false,
260  "-d", _("old cluster data resides"), false);
261  check_required_directory(&new_cluster.pgdata, "PGDATANEW", false,
262  "-D", _("new cluster data resides"), false);
263  check_required_directory(&user_opts.socketdir, "PGSOCKETDIR", true,
264  "-s", _("sockets will be created"), false);
265 
266 #ifdef WIN32
267 
268  /*
269  * On Windows, initdb --sync-only will fail with a "Permission denied"
270  * error on file pg_upgrade_utility.log if pg_upgrade is run inside the
271  * new cluster directory, so we do a check here.
272  */
273  {
274  char cwd[MAXPGPATH],
275  new_cluster_pgdata[MAXPGPATH];
276 
277  strlcpy(new_cluster_pgdata, new_cluster.pgdata, MAXPGPATH);
278  canonicalize_path(new_cluster_pgdata);
279 
280  if (!getcwd(cwd, MAXPGPATH))
281  pg_fatal("could not determine current directory\n");
282  canonicalize_path(cwd);
283  if (path_is_prefix_of_path(new_cluster_pgdata, cwd))
284  pg_fatal("cannot run pg_upgrade from inside the new cluster data directory on Windows\n");
285  }
286 #endif
287 }
const char * get_progname(const char *argv0)
Definition: path.c:453
int getopt_long(int argc, char *const argv[], const char *optstring, const struct option *longopts, int *longindex)
Definition: getopt_long.c:57
bool path_is_prefix_of_path(const char *path1, const char *path2)
Definition: path.c:438
char * psprintf(const char *fmt,...)
Definition: psprintf.c:46
int get_user_info(char **user_name_p)
Definition: util.c:211
#define FIX_DEFAULT_READ_ONLY
Definition: option.c:27
void canonicalize_path(char *path)
Definition: path.c:254
#define pg_fatal(...)
Definition: pg_rewind.h:37
unsigned short port
Definition: pg_upgrade.h:266
LogOpts log_opts
Definition: util.c:17
int jobs
Definition: pg_upgrade.h:293
#define fprintf
Definition: port.h:220
bool user_specified
Definition: pg_upgrade.h:311
char * pgopts
Definition: pg_upgrade.h:263
static void check_required_directory(char **dirpath, const char *envVarName, bool useCwd, const char *cmdLineOption, const char *description, bool missingOk)
Definition: option.c:366
ClusterInfo new_cluster
Definition: pg_upgrade.c:59
#define setenv(x, y, z)
Definition: win32_port.h:497
#define required_argument
Definition: getopt_long.h:25
void pfree(void *pointer)
Definition: mcxt.c:1169
int optind
Definition: getopt.c:50
#define MAXPGPATH
char * output_files[]
Definition: pg_upgrade.c:63
ClusterInfo old_cluster
Definition: pg_upgrade.c:59
char * pg_strdup(const char *in)
Definition: fe_memutils.c:85
transferMode transfer_mode
Definition: pg_upgrade.h:292
UserOpts user_opts
Definition: option.c:30
bool verbose
Definition: pg_upgrade.h:280
char * bindir
Definition: pg_upgrade.h:262
#define no_argument
Definition: getopt_long.h:24
#define DEF_PGUPORT
Definition: pg_upgrade.h:16
#define INTERNAL_LOG_FILE
Definition: pg_upgrade.h:32
#define free(a)
Definition: header.h:65
void void pg_log(eLogType type, const char *fmt,...) pg_attribute_printf(2
size_t strlcpy(char *dst, const char *src, size_t siz)
Definition: strlcpy.c:45
const char * progname
Definition: pg_upgrade.h:309
FILE * internal
Definition: pg_upgrade.h:279
bool check
Definition: pg_upgrade.h:290
void pg_free(void *ptr)
Definition: fe_memutils.c:105
static char * filename
Definition: pg_dumpall.c:91
#define fopen_priv(path, mode)
Definition: pg_upgrade.h:379
char * pgdata
Definition: pg_upgrade.h:259
char * optarg
Definition: getopt.c:52
OSInfo os_info
Definition: pg_upgrade.c:61
bool retain
Definition: pg_upgrade.h:281
char * user
Definition: pg_upgrade.h:310
char * socketdir
Definition: pg_upgrade.h:294
#define _(x)
Definition: elog.c:89
static void usage(void)
Definition: option.c:291
bool ind_coll_unknown
Definition: pg_upgrade.h:295

◆ usage()

static void usage ( void  )
static

Definition at line 291 of file option.c.

References _, new_cluster, old_cluster, os_info, ClusterInfo::port, printf, and OSInfo::user.

Referenced by parseCommandLine().

292 {
293  printf(_("pg_upgrade upgrades a PostgreSQL cluster to a different major version.\n\n"));
294  printf(_("Usage:\n"));
295  printf(_(" pg_upgrade [OPTION]...\n\n"));
296  printf(_("Options:\n"));
297  printf(_(" -b, --old-bindir=BINDIR old cluster executable directory\n"));
298  printf(_(" -B, --new-bindir=BINDIR new cluster executable directory (default\n"
299  " same directory as pg_upgrade)\n"));
300  printf(_(" -c, --check check clusters only, don't change any data\n"));
301  printf(_(" -d, --old-datadir=DATADIR old cluster data directory\n"));
302  printf(_(" -D, --new-datadir=DATADIR new cluster data directory\n"));
303  printf(_(" -j, --jobs=NUM number of simultaneous processes or threads to use\n"));
304  printf(_(" -k, --link link instead of copying files to new cluster\n"));
305  printf(_(" -o, --old-options=OPTIONS old cluster options to pass to the server\n"));
306  printf(_(" -O, --new-options=OPTIONS new cluster options to pass to the server\n"));
307  printf(_(" -p, --old-port=PORT old cluster port number (default %d)\n"), old_cluster.port);
308  printf(_(" -P, --new-port=PORT new cluster port number (default %d)\n"), new_cluster.port);
309  printf(_(" -r, --retain retain SQL and log files after success\n"));
310  printf(_(" -s, --socketdir=DIR socket directory to use (default current dir.)\n"));
311  printf(_(" -U, --username=NAME cluster superuser (default \"%s\")\n"), os_info.user);
312  printf(_(" -v, --verbose enable verbose internal logging\n"));
313  printf(_(" -V, --version display version information, then exit\n"));
314  printf(_(" --clone clone instead of copying files to new cluster\n"));
315  printf(_(" --index-collation-versions-unknown\n"
316  " mark text indexes as needing to be rebuilt\n"));
317  printf(_(" -?, --help show this help, then exit\n"));
318  printf(_("\n"
319  "Before running pg_upgrade you must:\n"
320  " create a new database cluster (using the new version of initdb)\n"
321  " shutdown the postmaster servicing the old cluster\n"
322  " shutdown the postmaster servicing the new cluster\n"));
323  printf(_("\n"
324  "When you run pg_upgrade, you must provide the following information:\n"
325  " the data directory for the old cluster (-d DATADIR)\n"
326  " the data directory for the new cluster (-D DATADIR)\n"
327  " the \"bin\" directory for the old version (-b BINDIR)\n"
328  " the \"bin\" directory for the new version (-B BINDIR)\n"));
329  printf(_("\n"
330  "For example:\n"
331  " pg_upgrade -d oldCluster/data -D newCluster/data -b oldCluster/bin -B newCluster/bin\n"
332  "or\n"));
333 #ifndef WIN32
334  printf(_(" $ export PGDATAOLD=oldCluster/data\n"
335  " $ export PGDATANEW=newCluster/data\n"
336  " $ export PGBINOLD=oldCluster/bin\n"
337  " $ export PGBINNEW=newCluster/bin\n"
338  " $ pg_upgrade\n"));
339 #else
340  printf(_(" C:\\> set PGDATAOLD=oldCluster/data\n"
341  " C:\\> set PGDATANEW=newCluster/data\n"
342  " C:\\> set PGBINOLD=oldCluster/bin\n"
343  " C:\\> set PGBINNEW=newCluster/bin\n"
344  " C:\\> pg_upgrade\n"));
345 #endif
346  printf(_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
347  printf(_("%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_URL);
348 }
unsigned short port
Definition: pg_upgrade.h:266
#define printf(...)
Definition: port.h:222
ClusterInfo new_cluster
Definition: pg_upgrade.c:59
ClusterInfo old_cluster
Definition: pg_upgrade.c:59
OSInfo os_info
Definition: pg_upgrade.c:61
char * user
Definition: pg_upgrade.h:310
#define _(x)
Definition: elog.c:89

Variable Documentation

◆ user_opts