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.116 2005/06/13 06:36:22 neilc 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
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 44
/*
 * Global psql options
 */
45
PsqlSettings pset;
46

47
#ifndef WIN32
48
#define SYSPSQLRC	"psqlrc"
B
Bruce Momjian 已提交
49
#define PSQLRC		".psqlrc"
50 51
#else
#define SYSPSQLRC	"psqlrc"
52
#define PSQLRC		"psqlrc.conf"
53
#endif
54

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

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

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

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

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

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

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

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

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

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

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

136
	pset.vars = CreateVariableSpace();
137 138
	if (!pset.vars)
	{
139
		fprintf(stderr, _("%s: out of memory\n"), pset.progname);
140 141
		exit(EXIT_FAILURE);
	}
142 143 144
	pset.popt.topt.format = PRINT_ALIGNED;
	pset.queryFout = stdout;
	pset.popt.topt.border = 1;
145
	pset.popt.topt.pager = 1;
146
	pset.popt.topt.normal_query = false;
147
	pset.popt.default_footer = true;
148

149
	SetVariable(pset.vars, "VERSION", PG_VERSION_STR);
150

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

158
	pset.verbosity = PQERRORS_DEFAULT;
159

160
	pset.notty = (!isatty(fileno(stdin)) || !isatty(fileno(stdout)));
161

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

169
	parse_psql_options(argc, argv, &options);
170

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

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

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

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

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

B
Bruce Momjian 已提交
212 213 214
	free(username);
	free(password);

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

222 223
	PQsetNoticeProcessor(pset.db, NoticeProcessor, NULL);

224
	SyncVariables();
P
Peter Eisentraut 已提交
225

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

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

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

237
	/*
238 239
	 * Now find something to do
	 */
B
Bruce Momjian 已提交
240

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

249
		successResult = process_file(options.action_string);
250 251
	}

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

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

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

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

		psql_scan_destroy(scan_state);
271 272
	}

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

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

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

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

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

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

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

	return successResult;
323 324 325 326 327 328 329 330 331
}



/*
 * Parse command line options
 */

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

	int			optindex;
	extern char *optarg;
	extern int	optind;
	int			c;
372
	bool		used_old_u_option = false;
373

374
	memset(options, 0, sizeof *options);
375

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

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

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

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

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

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

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

		optind++;
	}
565

566
	if (used_old_u_option && !QUIET())
567
		fprintf(stderr, _("%s: Warning: The -u option is deprecated. Use -U.\n"), pset.progname);
568

569 570 571 572
}


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

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

586 587
	snprintf(rc_file, MAXPGPATH, "%s/%s", etc_path, SYSPSQLRC);
	process_psqlrc_file(rc_file);
588

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



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

603 604
#if defined(WIN32) && (!defined(__MINGW32__))
#define R_OK 4
605 606
#endif

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

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



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

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



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

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

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



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

	wincp = GetACP();
	concp = GetConsoleCP();
B
Bruce Momjian 已提交
673 674
	if (wincp != concp)
	{
675
			printf(_("Warning: Console code page (%u) differs from Windows code page (%u)\n"
676 677
					   "         8-bit characters may not work correctly. See psql reference\n"
					   "         page \"Notes for Windows users\" for details.\n\n"),
B
Bruce Momjian 已提交
678
			   concp, wincp);
B
> >  
Bruce Momjian 已提交
679 680
	}
}
B
Bruce Momjian 已提交
681

B
> >  
Bruce Momjian 已提交
682
#endif