startup.c 14.5 KB
Newer Older
P
Peter Eisentraut 已提交
1 2 3
/*
 * psql - the PostgreSQL interactive terminal
 *
4
 * Copyright (c) 2000-2005, PostgreSQL Global Development Group
P
Peter Eisentraut 已提交
5
 *
6
 * $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.108 2005/01/01 05:43:08 momjian Exp $
P
Peter Eisentraut 已提交
7
 */
8
#include "postgres_fe.h"
9 10 11

#include <sys/types.h>

12 13
#ifndef WIN32
#include <unistd.h>
B
Bruce Momjian 已提交
14
#else							/* WIN32 */
15
#include <io.h>
16
#include <win32.h>
17
#endif   /* WIN32 */
18

19
#include "getopt_long.h"
20

21
#ifndef HAVE_INT_OPTRESET
B
Bruce Momjian 已提交
22
int			optreset;
23 24
#endif

P
Peter Eisentraut 已提交
25 26
#include <locale.h>

27
#include "libpq-fe.h"
28 29 30

#include "command.h"
#include "common.h"
31 32
#include "describe.h"
#include "help.h"
33
#include "input.h"
34
#include "mainloop.h"
35
#include "print.h"
36 37
#include "settings.h"
#include "variables.h"
38

39 40
#include "mb/pg_wchar.h"

41 42 43
/*
 * Global psql options
 */
44
PsqlSettings pset;
45

46
#define SYSPSQLRC	"psqlrc"
B
Bruce Momjian 已提交
47
#define PSQLRC		".psqlrc"
48

49 50
/*
 * Structures to pass information between the option parsing routine
51 52
 * and the main function
 */
B
Bruce Momjian 已提交
53 54
enum _actions
{
55 56 57 58 59
	ACT_NOTHING = 0,
	ACT_SINGLE_SLASH,
	ACT_LIST_DB,
	ACT_SINGLE_QUERY,
	ACT_FILE
60 61
};

B
Bruce Momjian 已提交
62 63 64 65 66 67 68 69 70
struct adhoc_opts
{
	char	   *dbname;
	char	   *host;
	char	   *port;
	char	   *username;
	enum _actions action;
	char	   *action_string;
	bool		no_readline;
71
	bool		no_psqlrc;
72 73
};

74
static void parse_psql_options(int argc, char *argv[],
B
Bruce Momjian 已提交
75
				   struct adhoc_opts * options);
76
static void process_psqlrc(char *argv0);
77
static void process_psqlrc_file(char *filename);
78
static void showVersion(void);
79

B
Bruce Momjian 已提交
80
#ifdef USE_SSL
81
static void printSSLInfo(void);
B
Bruce Momjian 已提交
82
#endif
83

B
> >  
Bruce Momjian 已提交
84 85 86 87
#ifdef WIN32
static void
			checkWin32Codepage(void);
#endif
88 89 90

/*
 *
91
 * main
92 93 94
 *
 */
int
95
main(int argc, char *argv[])
96
{
B
Bruce Momjian 已提交
97 98
	struct adhoc_opts options;
	int			successResult;
99

B
Bruce Momjian 已提交
100 101 102
	char	   *username = NULL;
	char	   *password = NULL;
	bool		need_pass;
103

104
	set_pglocale_pgservice(argv[0], "psql");
P
Peter Eisentraut 已提交
105

106
	pset.progname = get_progname(argv[0]);
107

108 109
	if (argc > 1)
	{
B
Bruce Momjian 已提交
110
		if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") == 0)
111 112 113 114
		{
			usage();
			exit(EXIT_SUCCESS);
		}
B
Bruce Momjian 已提交
115
		if (strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-V") == 0)
116 117 118 119
		{
			showVersion();
			exit(EXIT_SUCCESS);
		}
B
Bruce Momjian 已提交
120
	}
121

122
#ifdef WIN32
B
Bruce Momjian 已提交
123
	setvbuf(stderr, NULL, _IONBF, 0);
124
	setup_win32_locks();
125
#endif
126 127
	pset.cur_cmd_source = stdin;
	pset.cur_cmd_interactive = false;
128
	pset.encoding = PQenv2encoding();
129

130
	pset.vars = CreateVariableSpace();
131 132
	if (!pset.vars)
	{
P
Peter Eisentraut 已提交
133
		fprintf(stderr, gettext("%s: out of memory\n"), pset.progname);
134 135
		exit(EXIT_FAILURE);
	}
136 137 138
	pset.popt.topt.format = PRINT_ALIGNED;
	pset.queryFout = stdout;
	pset.popt.topt.border = 1;
139
	pset.popt.topt.pager = 1;
140
	pset.popt.default_footer = true;
141

142
	SetVariable(pset.vars, "VERSION", PG_VERSION_STR);
143

144
	/* Default values for variables */
145
	SetVariableBool(pset.vars, "AUTOCOMMIT");
146
	SetVariable(pset.vars, "VERBOSITY", "default");
147 148 149 150
	SetVariable(pset.vars, "PROMPT1", DEFAULT_PROMPT1);
	SetVariable(pset.vars, "PROMPT2", DEFAULT_PROMPT2);
	SetVariable(pset.vars, "PROMPT3", DEFAULT_PROMPT3);

151
	pset.verbosity = PQERRORS_DEFAULT;
152

153
	pset.notty = (!isatty(fileno(stdin)) || !isatty(fileno(stdout)));
154

155
	/* This is obsolete and should be removed sometime. */
156
#ifdef PSQL_ALWAYS_GET_PASSWORDS
157
	pset.getPassword = true;
158
#else
159
	pset.getPassword = false;
160 161
#endif

162
	parse_psql_options(argc, argv, &options);
163

164
	if (!pset.popt.topt.fieldSep)
165
		pset.popt.topt.fieldSep = pg_strdup(DEFAULT_FIELD_SEP);
166
	if (!pset.popt.topt.recordSep)
167
		pset.popt.topt.recordSep = pg_strdup(DEFAULT_RECORD_SEP);
168

B
Bruce Momjian 已提交
169 170
	if (options.username)
	{
171 172 173 174 175
		/*
		 * The \001 is a hack to support the deprecated -u option which
		 * issues a username prompt. The recommended option is -U followed
		 * by the name on the command line.
		 */
176
		if (strcmp(options.username, "\001") == 0)
177
			username = simple_prompt("User name: ", 100, true);
B
Bruce Momjian 已提交
178
		else
179
			username = pg_strdup(options.username);
180 181
	}

182
	if (pset.getPassword)
B
Bruce Momjian 已提交
183
		password = simple_prompt("Password: ", 100, false);
184

B
Bruce Momjian 已提交
185 186 187 188
	/* loop until we have a password if requested by backend */
	do
	{
		need_pass = false;
189
		pset.db = PQsetdbLogin(options.host, options.port, NULL, NULL,
190 191
			options.action == ACT_LIST_DB ? "template1" : options.dbname,
							   username, password);
B
Bruce Momjian 已提交
192

193
		if (PQstatus(pset.db) == CONNECTION_BAD &&
194
			strcmp(PQerrorMessage(pset.db), PQnoPasswordSupplied) == 0 &&
195
			!feof(stdin))
B
Bruce Momjian 已提交
196
		{
197
			PQfinish(pset.db);
B
Bruce Momjian 已提交
198 199 200 201 202 203
			need_pass = true;
			free(password);
			password = NULL;
			password = simple_prompt("Password: ", 100, false);
		}
	} while (need_pass);
204

B
Bruce Momjian 已提交
205 206 207
	free(username);
	free(password);

208
	if (PQstatus(pset.db) == CONNECTION_BAD)
B
Bruce Momjian 已提交
209
	{
210
		fprintf(stderr, "%s: %s", pset.progname, PQerrorMessage(pset.db));
211
		PQfinish(pset.db);
B
Bruce Momjian 已提交
212 213 214
		exit(EXIT_BADCONN);
	}

215 216
	PQsetNoticeProcessor(pset.db, NoticeProcessor, NULL);

217
	SyncVariables();
P
Peter Eisentraut 已提交
218

219 220 221
	/* Grab the backend server version */
	pset.sversion = PQserverVersion(pset.db);

B
Bruce Momjian 已提交
222 223
	if (options.action == ACT_LIST_DB)
	{
224
		int			success = listAllDbs(false);
B
Bruce Momjian 已提交
225

226
		PQfinish(pset.db);
227
		exit(success ? EXIT_SUCCESS : EXIT_FAILURE);
B
Bruce Momjian 已提交
228 229
	}

230
	/*
231 232
	 * Now find something to do
	 */
B
Bruce Momjian 已提交
233

234
	/*
235 236
	 * process file given by -f
	 */
237
	if (options.action == ACT_FILE && strcmp(options.action_string, "-") != 0)
238 239
	{
		if (!options.no_psqlrc)
240
			process_psqlrc(argv[0]);
241

242
		successResult = process_file(options.action_string);
243 244
	}

245
	/*
246 247
	 * process slash command if one was given to -c
	 */
B
Bruce Momjian 已提交
248
	else if (options.action == ACT_SINGLE_SLASH)
249
	{
250 251
		PsqlScanState scan_state;

252
		if (VariableEquals(pset.vars, "ECHO", "all"))
253
			puts(options.action_string);
254

255 256 257 258 259 260
		scan_state = psql_scan_create();
		psql_scan_setup(scan_state,
						options.action_string,
						strlen(options.action_string));

		successResult = HandleSlashCmds(scan_state, NULL) != CMD_ERROR
261
			? EXIT_SUCCESS : EXIT_FAILURE;
262 263

		psql_scan_destroy(scan_state);
264 265
	}

266
	/*
267 268
	 * If the query given to -c was a normal one, send it
	 */
B
Bruce Momjian 已提交
269
	else if (options.action == ACT_SINGLE_QUERY)
270
	{
271
		if (VariableEquals(pset.vars, "ECHO", "all"))
272
			puts(options.action_string);
273

274
		successResult = SendQuery(options.action_string)
275 276 277
			? EXIT_SUCCESS : EXIT_FAILURE;
	}

278
	/*
279 280
	 * or otherwise enter interactive main loop
	 */
B
Bruce Momjian 已提交
281
	else
282
	{
283 284 285
		if (!options.no_psqlrc)
			process_psqlrc(argv[0]);

286 287
		if (!QUIET() && !pset.notty)
		{
288
			printf(gettext("Welcome to %s %s, the PostgreSQL interactive terminal.\n\n"
P
Peter Eisentraut 已提交
289 290
						   "Type:  \\copyright for distribution terms\n"
						   "       \\h for help with SQL commands\n"
291
						   "       \\? for help with psql commands\n"
B
Bruce Momjian 已提交
292
			  "       \\g or terminate with semicolon to execute query\n"
P
Peter Eisentraut 已提交
293
						   "       \\q to quit\n\n"),
294
				   pset.progname, PG_VERSION);
B
Bruce Momjian 已提交
295
#ifdef USE_SSL
296
			printSSLInfo();
B
> >  
Bruce Momjian 已提交
297 298 299
#endif
#ifdef WIN32
			checkWin32Codepage();
B
Bruce Momjian 已提交
300
#endif
301 302
		}

303 304
		if (!pset.notty)
			initializeInput(options.no_readline ? 0 : 1);
305
		if (options.action_string)		/* -f - was used */
306
			pset.inputfile = "<stdin>";
307

P
Peter Eisentraut 已提交
308
		successResult = MainLoop(stdin);
309
	}
B
Bruce Momjian 已提交
310 311

	/* clean up */
312 313
	PQfinish(pset.db);
	setQFout(NULL);
B
Bruce Momjian 已提交
314 315

	return successResult;
316 317 318 319 320 321 322 323 324
}



/*
 * Parse command line options
 */

static void
325
parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
326
{
327
	static struct option long_options[] =
328 329
	{
		{"echo-all", no_argument, NULL, 'a'},
B
Bruce Momjian 已提交
330 331 332
		{"no-align", no_argument, NULL, 'A'},
		{"command", required_argument, NULL, 'c'},
		{"dbname", required_argument, NULL, 'd'},
333
		{"echo-queries", no_argument, NULL, 'e'},
334
		{"echo-hidden", no_argument, NULL, 'E'},
B
Bruce Momjian 已提交
335
		{"file", required_argument, NULL, 'f'},
336
		{"field-separator", required_argument, NULL, 'F'},
B
Bruce Momjian 已提交
337 338 339
		{"host", required_argument, NULL, 'h'},
		{"html", no_argument, NULL, 'H'},
		{"list", no_argument, NULL, 'l'},
340
		{"no-readline", no_argument, NULL, 'n'},
341
		{"output", required_argument, NULL, 'o'},
B
Bruce Momjian 已提交
342 343 344
		{"port", required_argument, NULL, 'p'},
		{"pset", required_argument, NULL, 'P'},
		{"quiet", no_argument, NULL, 'q'},
345
		{"record-separator", required_argument, NULL, 'R'},
B
Bruce Momjian 已提交
346 347 348 349 350 351 352 353 354
		{"single-step", no_argument, NULL, 's'},
		{"single-line", no_argument, NULL, 'S'},
		{"tuples-only", no_argument, NULL, 't'},
		{"table-attr", required_argument, NULL, 'T'},
		{"username", required_argument, NULL, 'U'},
		{"set", required_argument, NULL, 'v'},
		{"variable", required_argument, NULL, 'v'},
		{"version", no_argument, NULL, 'V'},
		{"password", no_argument, NULL, 'W'},
355
		{"expanded", no_argument, NULL, 'x'},
356
		{"no-psqlrc", no_argument, NULL, 'X'},
B
Bruce Momjian 已提交
357
		{"help", no_argument, NULL, '?'},
T
Tatsuo Ishii 已提交
358
		{NULL, 0, NULL, 0}
B
Bruce Momjian 已提交
359 360 361 362 363 364
	};

	int			optindex;
	extern char *optarg;
	extern int	optind;
	int			c;
365
	bool		used_old_u_option = false;
366

367
	memset(options, 0, sizeof *options);
368

369 370
	while ((c = getopt_long(argc, argv, "aAc:d:eEf:F:h:Hlno:p:P:qR:sStT:uU:v:VWxX?",
							long_options, &optindex)) != -1)
371
	{
B
Bruce Momjian 已提交
372 373
		switch (c)
		{
374 375 376
			case 'a':
				SetVariable(pset.vars, "ECHO", "all");
				break;
B
Bruce Momjian 已提交
377
			case 'A':
378
				pset.popt.topt.format = PRINT_UNALIGNED;
B
Bruce Momjian 已提交
379 380 381 382
				break;
			case 'c':
				options->action_string = optarg;
				if (optarg[0] == '\\')
P
Peter Eisentraut 已提交
383
				{
B
Bruce Momjian 已提交
384
					options->action = ACT_SINGLE_SLASH;
P
Peter Eisentraut 已提交
385 386
					options->action_string++;
				}
B
Bruce Momjian 已提交
387 388 389 390 391 392 393
				else
					options->action = ACT_SINGLE_QUERY;
				break;
			case 'd':
				options->dbname = optarg;
				break;
			case 'e':
394
				SetVariable(pset.vars, "ECHO", "queries");
B
Bruce Momjian 已提交
395 396
				break;
			case 'E':
397
				SetVariableBool(pset.vars, "ECHO_HIDDEN");
B
Bruce Momjian 已提交
398 399 400 401 402 403
				break;
			case 'f':
				options->action = ACT_FILE;
				options->action_string = optarg;
				break;
			case 'F':
404
				pset.popt.topt.fieldSep = pg_strdup(optarg);
B
Bruce Momjian 已提交
405 406 407 408 409
				break;
			case 'h':
				options->host = optarg;
				break;
			case 'H':
410
				pset.popt.topt.format = PRINT_HTML;
B
Bruce Momjian 已提交
411 412 413 414 415 416 417 418
				break;
			case 'l':
				options->action = ACT_LIST_DB;
				break;
			case 'n':
				options->no_readline = true;
				break;
			case 'o':
419
				setQFout(optarg);
B
Bruce Momjian 已提交
420 421 422 423 424 425 426 427 428 429
				break;
			case 'p':
				options->port = optarg;
				break;
			case 'P':
				{
					char	   *value;
					char	   *equal_loc;
					bool		result;

430
					value = pg_strdup(optarg);
B
Bruce Momjian 已提交
431 432
					equal_loc = strchr(value, '=');
					if (!equal_loc)
433
						result = do_pset(value, NULL, &pset.popt, true);
B
Bruce Momjian 已提交
434 435 436
					else
					{
						*equal_loc = '\0';
437
						result = do_pset(value, equal_loc + 1, &pset.popt, true);
B
Bruce Momjian 已提交
438 439 440 441
					}

					if (!result)
					{
442
						fprintf(stderr, gettext("%s: couldn't set printing parameter \"%s\"\n"), pset.progname, value);
B
Bruce Momjian 已提交
443 444 445 446 447 448 449
						exit(EXIT_FAILURE);
					}

					free(value);
					break;
				}
			case 'q':
450
				SetVariableBool(pset.vars, "QUIET");
B
Bruce Momjian 已提交
451
				break;
452
			case 'R':
453
				pset.popt.topt.recordSep = pg_strdup(optarg);
454
				break;
B
Bruce Momjian 已提交
455
			case 's':
456
				SetVariableBool(pset.vars, "SINGLESTEP");
B
Bruce Momjian 已提交
457 458
				break;
			case 'S':
459
				SetVariableBool(pset.vars, "SINGLELINE");
B
Bruce Momjian 已提交
460 461
				break;
			case 't':
462
				pset.popt.topt.tuples_only = true;
B
Bruce Momjian 已提交
463 464
				break;
			case 'T':
465
				pset.popt.topt.tableAttr = pg_strdup(optarg);
B
Bruce Momjian 已提交
466 467
				break;
			case 'u':
468
				pset.getPassword = true;
469 470 471 472
				options->username = "\001";		/* hopefully nobody has
												 * that username */
				/* this option is out */
				used_old_u_option = true;
B
Bruce Momjian 已提交
473 474 475 476 477 478 479 480 481
				break;
			case 'U':
				options->username = optarg;
				break;
			case 'v':
				{
					char	   *value;
					char	   *equal_loc;

482
					value = pg_strdup(optarg);
B
Bruce Momjian 已提交
483 484 485
					equal_loc = strchr(value, '=');
					if (!equal_loc)
					{
486
						if (!DeleteVariable(pset.vars, value))
B
Bruce Momjian 已提交
487
						{
488
							fprintf(stderr, gettext("%s: could not delete variable \"%s\"\n"),
489
									pset.progname, value);
B
Bruce Momjian 已提交
490 491 492 493 494 495
							exit(EXIT_FAILURE);
						}
					}
					else
					{
						*equal_loc = '\0';
496
						if (!SetVariable(pset.vars, value, equal_loc + 1))
B
Bruce Momjian 已提交
497
						{
498
							fprintf(stderr, gettext("%s: could not set variable \"%s\"\n"),
499
									pset.progname, value);
B
Bruce Momjian 已提交
500 501 502 503 504 505 506 507
							exit(EXIT_FAILURE);
						}
					}

					free(value);
					break;
				}
			case 'V':
508 509
				showVersion();
				exit(EXIT_SUCCESS);
B
Bruce Momjian 已提交
510
			case 'W':
511
				pset.getPassword = true;
B
Bruce Momjian 已提交
512
				break;
513 514 515
			case 'x':
				pset.popt.topt.expanded = true;
				break;
516 517 518
			case 'X':
				options->no_psqlrc = true;
				break;
B
Bruce Momjian 已提交
519
			case '?':
520 521 522 523 524 525 526 527 528
				/* Actual help option given */
				if (strcmp(argv[optind - 1], "-?") == 0 || strcmp(argv[optind - 1], "--help") == 0)
				{
					usage();
					exit(EXIT_SUCCESS);
				}
				/* unknown option reported by getopt */
				else
				{
529
					fprintf(stderr, gettext("Try \"%s --help\" for more information.\n"),
530
							pset.progname);
531
					exit(EXIT_FAILURE);
532
				}
B
Bruce Momjian 已提交
533 534
				break;
			default:
535
				fprintf(stderr, gettext("Try \"%s --help\" for more information.\n"),
536
						pset.progname);
537
				exit(EXIT_FAILURE);
B
Bruce Momjian 已提交
538 539
				break;
		}
540 541
	}

B
Bruce Momjian 已提交
542 543 544 545 546 547 548 549 550 551
	/*
	 * if we still have arguments, use it as the database name and
	 * username
	 */
	while (argc - optind >= 1)
	{
		if (!options->dbname)
			options->dbname = argv[optind];
		else if (!options->username)
			options->username = argv[optind];
552
		else if (!QUIET())
553
			fprintf(stderr, gettext("%s: warning: extra command-line argument \"%s\" ignored\n"),
554
					pset.progname, argv[optind]);
B
Bruce Momjian 已提交
555 556 557

		optind++;
	}
558

559
	if (used_old_u_option && !QUIET())
P
Peter Eisentraut 已提交
560
		fprintf(stderr, gettext("%s: Warning: The -u option is deprecated. Use -U.\n"), pset.progname);
561

562 563 564 565
}


/*
P
Peter Eisentraut 已提交
566
 * Load .psqlrc file, if found.
567 568
 */
static void
569
process_psqlrc(char *argv0)
570
{
571
	char	   *psqlrc;
B
Bruce Momjian 已提交
572 573 574 575
	char		home[MAXPGPATH];
	char		global_file[MAXPGPATH];
	char		my_exec_path[MAXPGPATH];
	char		etc_path[MAXPGPATH];
576 577 578

	find_my_exec(argv0, my_exec_path);
	get_etc_path(my_exec_path, etc_path);
579

580 581
	snprintf(global_file, MAXPGPATH, "%s/%s", etc_path, SYSPSQLRC);
	process_psqlrc_file(global_file);
582

583
	if (get_home_path(home))
584 585 586 587
	{
		psqlrc = pg_malloc(strlen(home) + 1 + strlen(PSQLRC) + 1);
		sprintf(psqlrc, "%s/%s", home, PSQLRC);
		process_psqlrc_file(psqlrc);
N
Neil Conway 已提交
588
		free(psqlrc);
589 590 591 592 593 594 595 596 597
	}
}



static void
process_psqlrc_file(char *filename)
{
	char	   *psqlrc;
598

599 600
#if defined(WIN32) && (!defined(__MINGW32__))
#define R_OK 4
601 602
#endif

603 604
	psqlrc = pg_malloc(strlen(filename) + 1 + strlen(PG_VERSION) + 1);
	sprintf(psqlrc, "%s-%s", filename, PG_VERSION);
605

606 607 608
	if (access(psqlrc, R_OK) == 0)
		process_file(psqlrc);
	else if (access(filename, R_OK) == 0)
B
Bruce Momjian 已提交
609
		process_file(filename);
610
	free(psqlrc);
611 612 613 614 615 616
}



/* showVersion
 *
617
 * This output format is intended to match GNU standards.
618 619
 */
static void
620
showVersion(void)
621
{
622
	puts("psql (PostgreSQL) " PG_VERSION);
623

624
#if defined(USE_READLINE)
625
	puts(gettext("contains support for command-line editing"));
626
#endif
627
}
B
Bruce Momjian 已提交
628 629 630 631 632 633 634 635 636



/*
 * printSSLInfo
 *
 * Prints information about the current SSL connection, if SSL is in use
 */
#ifdef USE_SSL
B
Bruce Momjian 已提交
637
static void
B
Bruce Momjian 已提交
638 639
printSSLInfo(void)
{
B
Bruce Momjian 已提交
640 641
	int			sslbits = -1;
	SSL		   *ssl;
B
Bruce Momjian 已提交
642 643 644

	ssl = PQgetssl(pset.db);
	if (!ssl)
B
Bruce Momjian 已提交
645
		return;					/* no SSL */
B
Bruce Momjian 已提交
646 647

	SSL_get_cipher_bits(ssl, &sslbits);
648
	printf(gettext("SSL connection (cipher: %s, bits: %i)\n\n"),
B
Bruce Momjian 已提交
649
		   SSL_get_cipher(ssl), sslbits);
B
Bruce Momjian 已提交
650 651
}
#endif
B
> >  
Bruce Momjian 已提交
652 653 654 655 656 657 658 659 660 661 662 663



/*
 * checkWin32Codepage
 *
 * Prints a warning when win32 console codepage differs from Windows codepage
 */
#ifdef WIN32
static void
checkWin32Codepage(void)
{
B
Bruce Momjian 已提交
664 665
	unsigned int wincp,
				concp;
B
> >  
Bruce Momjian 已提交
666 667 668

	wincp = GetACP();
	concp = GetConsoleCP();
B
Bruce Momjian 已提交
669 670 671 672 673 674
	if (wincp != concp)
	{
		printf("Warning: Console codepage (%u) differs from windows codepage (%u)\n"
			   "         8-bit characters will not work correctly. See PostgreSQL\n"
			   "         documentation \"Installation on Windows\" for details.\n\n",
			   concp, wincp);
B
> >  
Bruce Momjian 已提交
675 676
	}
}
B
Bruce Momjian 已提交
677

B
> >  
Bruce Momjian 已提交
678
#endif