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.109 2005/01/06 18:29:09 tgl 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
#ifndef WIN32
47
#define SYSPSQLRC	"psqlrc"
B
Bruce Momjian 已提交
48
#define PSQLRC		".psqlrc"
49 50 51 52
#else
#define SYSPSQLRC	"psqlrc"
#define PSQLRC		"psqlrc.txt"
#endif
53

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

B
Bruce Momjian 已提交
67 68 69 70 71 72 73 74 75
struct adhoc_opts
{
	char	   *dbname;
	char	   *host;
	char	   *port;
	char	   *username;
	enum _actions action;
	char	   *action_string;
	bool		no_readline;
76
	bool		no_psqlrc;
77 78
};

79
static void parse_psql_options(int argc, char *argv[],
B
Bruce Momjian 已提交
80
				   struct adhoc_opts * options);
81
static void process_psqlrc(char *argv0);
82
static void process_psqlrc_file(char *filename);
83
static void showVersion(void);
84

B
Bruce Momjian 已提交
85
#ifdef USE_SSL
86
static void printSSLInfo(void);
B
Bruce Momjian 已提交
87
#endif
88

B
> >  
Bruce Momjian 已提交
89 90 91 92
#ifdef WIN32
static void
			checkWin32Codepage(void);
#endif
93 94 95

/*
 *
96
 * main
97 98 99
 *
 */
int
100
main(int argc, char *argv[])
101
{
B
Bruce Momjian 已提交
102 103
	struct adhoc_opts options;
	int			successResult;
104

B
Bruce Momjian 已提交
105 106 107
	char	   *username = NULL;
	char	   *password = NULL;
	bool		need_pass;
108

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

111
	pset.progname = get_progname(argv[0]);
112

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

127
#ifdef WIN32
B
Bruce Momjian 已提交
128
	setvbuf(stderr, NULL, _IONBF, 0);
129
	setup_win32_locks();
130
#endif
131 132
	pset.cur_cmd_source = stdin;
	pset.cur_cmd_interactive = false;
133
	pset.encoding = PQenv2encoding();
134

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

147
	SetVariable(pset.vars, "VERSION", PG_VERSION_STR);
148

149
	/* Default values for variables */
150
	SetVariableBool(pset.vars, "AUTOCOMMIT");
151
	SetVariable(pset.vars, "VERBOSITY", "default");
152 153 154 155
	SetVariable(pset.vars, "PROMPT1", DEFAULT_PROMPT1);
	SetVariable(pset.vars, "PROMPT2", DEFAULT_PROMPT2);
	SetVariable(pset.vars, "PROMPT3", DEFAULT_PROMPT3);

156
	pset.verbosity = PQERRORS_DEFAULT;
157

158
	pset.notty = (!isatty(fileno(stdin)) || !isatty(fileno(stdout)));
159

160
	/* This is obsolete and should be removed sometime. */
161
#ifdef PSQL_ALWAYS_GET_PASSWORDS
162
	pset.getPassword = true;
163
#else
164
	pset.getPassword = false;
165 166
#endif

167
	parse_psql_options(argc, argv, &options);
168

169
	if (!pset.popt.topt.fieldSep)
170
		pset.popt.topt.fieldSep = pg_strdup(DEFAULT_FIELD_SEP);
171
	if (!pset.popt.topt.recordSep)
172
		pset.popt.topt.recordSep = pg_strdup(DEFAULT_RECORD_SEP);
173

B
Bruce Momjian 已提交
174 175
	if (options.username)
	{
176 177 178 179 180
		/*
		 * 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.
		 */
181
		if (strcmp(options.username, "\001") == 0)
182
			username = simple_prompt("User name: ", 100, true);
B
Bruce Momjian 已提交
183
		else
184
			username = pg_strdup(options.username);
185 186
	}

187
	if (pset.getPassword)
B
Bruce Momjian 已提交
188
		password = simple_prompt("Password: ", 100, false);
189

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

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

B
Bruce Momjian 已提交
210 211 212
	free(username);
	free(password);

213
	if (PQstatus(pset.db) == CONNECTION_BAD)
B
Bruce Momjian 已提交
214
	{
215
		fprintf(stderr, "%s: %s", pset.progname, PQerrorMessage(pset.db));
216
		PQfinish(pset.db);
B
Bruce Momjian 已提交
217 218 219
		exit(EXIT_BADCONN);
	}

220 221
	PQsetNoticeProcessor(pset.db, NoticeProcessor, NULL);

222
	SyncVariables();
P
Peter Eisentraut 已提交
223

224 225 226
	/* Grab the backend server version */
	pset.sversion = PQserverVersion(pset.db);

B
Bruce Momjian 已提交
227 228
	if (options.action == ACT_LIST_DB)
	{
229
		int			success = listAllDbs(false);
B
Bruce Momjian 已提交
230

231
		PQfinish(pset.db);
232
		exit(success ? EXIT_SUCCESS : EXIT_FAILURE);
B
Bruce Momjian 已提交
233 234
	}

235
	/*
236 237
	 * Now find something to do
	 */
B
Bruce Momjian 已提交
238

239
	/*
240 241
	 * process file given by -f
	 */
242
	if (options.action == ACT_FILE && strcmp(options.action_string, "-") != 0)
243 244
	{
		if (!options.no_psqlrc)
245
			process_psqlrc(argv[0]);
246

247
		successResult = process_file(options.action_string);
248 249
	}

250
	/*
251 252
	 * process slash command if one was given to -c
	 */
B
Bruce Momjian 已提交
253
	else if (options.action == ACT_SINGLE_SLASH)
254
	{
255 256
		PsqlScanState scan_state;

257
		if (VariableEquals(pset.vars, "ECHO", "all"))
258
			puts(options.action_string);
259

260 261 262 263 264 265
		scan_state = psql_scan_create();
		psql_scan_setup(scan_state,
						options.action_string,
						strlen(options.action_string));

		successResult = HandleSlashCmds(scan_state, NULL) != CMD_ERROR
266
			? EXIT_SUCCESS : EXIT_FAILURE;
267 268

		psql_scan_destroy(scan_state);
269 270
	}

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

279
		successResult = SendQuery(options.action_string)
280 281 282
			? EXIT_SUCCESS : EXIT_FAILURE;
	}

283
	/*
284 285
	 * or otherwise enter interactive main loop
	 */
B
Bruce Momjian 已提交
286
	else
287
	{
288 289 290
		if (!options.no_psqlrc)
			process_psqlrc(argv[0]);

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

308 309
		if (!pset.notty)
			initializeInput(options.no_readline ? 0 : 1);
310
		if (options.action_string)		/* -f - was used */
311
			pset.inputfile = "<stdin>";
312

P
Peter Eisentraut 已提交
313
		successResult = MainLoop(stdin);
314
	}
B
Bruce Momjian 已提交
315 316

	/* clean up */
317 318
	PQfinish(pset.db);
	setQFout(NULL);
B
Bruce Momjian 已提交
319 320

	return successResult;
321 322 323 324 325 326 327 328 329
}



/*
 * Parse command line options
 */

static void
330
parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
331
{
332
	static struct option long_options[] =
333 334
	{
		{"echo-all", no_argument, NULL, 'a'},
B
Bruce Momjian 已提交
335 336 337
		{"no-align", no_argument, NULL, 'A'},
		{"command", required_argument, NULL, 'c'},
		{"dbname", required_argument, NULL, 'd'},
338
		{"echo-queries", no_argument, NULL, 'e'},
339
		{"echo-hidden", no_argument, NULL, 'E'},
B
Bruce Momjian 已提交
340
		{"file", required_argument, NULL, 'f'},
341
		{"field-separator", required_argument, NULL, 'F'},
B
Bruce Momjian 已提交
342 343 344
		{"host", required_argument, NULL, 'h'},
		{"html", no_argument, NULL, 'H'},
		{"list", no_argument, NULL, 'l'},
345
		{"no-readline", no_argument, NULL, 'n'},
346
		{"output", required_argument, NULL, 'o'},
B
Bruce Momjian 已提交
347 348 349
		{"port", required_argument, NULL, 'p'},
		{"pset", required_argument, NULL, 'P'},
		{"quiet", no_argument, NULL, 'q'},
350
		{"record-separator", required_argument, NULL, 'R'},
B
Bruce Momjian 已提交
351 352 353 354 355 356 357 358 359
		{"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'},
360
		{"expanded", no_argument, NULL, 'x'},
361
		{"no-psqlrc", no_argument, NULL, 'X'},
B
Bruce Momjian 已提交
362
		{"help", no_argument, NULL, '?'},
T
Tatsuo Ishii 已提交
363
		{NULL, 0, NULL, 0}
B
Bruce Momjian 已提交
364 365 366 367 368 369
	};

	int			optindex;
	extern char *optarg;
	extern int	optind;
	int			c;
370
	bool		used_old_u_option = false;
371

372
	memset(options, 0, sizeof *options);
373

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

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

					if (!result)
					{
447
						fprintf(stderr, gettext("%s: couldn't set printing parameter \"%s\"\n"), pset.progname, value);
B
Bruce Momjian 已提交
448 449 450 451 452 453 454
						exit(EXIT_FAILURE);
					}

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

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

					free(value);
					break;
				}
			case 'V':
513 514
				showVersion();
				exit(EXIT_SUCCESS);
B
Bruce Momjian 已提交
515
			case 'W':
516
				pset.getPassword = true;
B
Bruce Momjian 已提交
517
				break;
518 519 520
			case 'x':
				pset.popt.topt.expanded = true;
				break;
521 522 523
			case 'X':
				options->no_psqlrc = true;
				break;
B
Bruce Momjian 已提交
524
			case '?':
525 526 527 528 529 530 531 532 533
				/* 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
				{
534
					fprintf(stderr, gettext("Try \"%s --help\" for more information.\n"),
535
							pset.progname);
536
					exit(EXIT_FAILURE);
537
				}
B
Bruce Momjian 已提交
538 539
				break;
			default:
540
				fprintf(stderr, gettext("Try \"%s --help\" for more information.\n"),
541
						pset.progname);
542
				exit(EXIT_FAILURE);
B
Bruce Momjian 已提交
543 544
				break;
		}
545 546
	}

B
Bruce Momjian 已提交
547 548 549 550 551 552 553 554 555 556
	/*
	 * 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];
557
		else if (!QUIET())
558
			fprintf(stderr, gettext("%s: warning: extra command-line argument \"%s\" ignored\n"),
559
					pset.progname, argv[optind]);
B
Bruce Momjian 已提交
560 561 562

		optind++;
	}
563

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

567 568 569 570
}


/*
P
Peter Eisentraut 已提交
571
 * Load .psqlrc file, if found.
572 573
 */
static void
574
process_psqlrc(char *argv0)
575
{
B
Bruce Momjian 已提交
576
	char		home[MAXPGPATH];
577
	char		rc_file[MAXPGPATH];
B
Bruce Momjian 已提交
578 579
	char		my_exec_path[MAXPGPATH];
	char		etc_path[MAXPGPATH];
580 581 582

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

584 585
	snprintf(rc_file, MAXPGPATH, "%s/%s", etc_path, SYSPSQLRC);
	process_psqlrc_file(rc_file);
586

587
	if (get_home_path(home))
588
	{
589 590
		snprintf(rc_file, MAXPGPATH, "%s/%s", home, PSQLRC);
		process_psqlrc_file(rc_file);
591 592 593 594 595 596 597 598 599
	}
}



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

601 602
#if defined(WIN32) && (!defined(__MINGW32__))
#define R_OK 4
603 604
#endif

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

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



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

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



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

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

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



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

	wincp = GetACP();
	concp = GetConsoleCP();
B
Bruce Momjian 已提交
671 672 673 674 675 676
	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 已提交
677 678
	}
}
B
Bruce Momjian 已提交
679

B
> >  
Bruce Momjian 已提交
680
#endif