OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / I386LINUX / util / I386LINUX / doc / postgresql / html / libpq-envars.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <HTML
3 ><HEAD
4 ><TITLE
5 >Environment Variables</TITLE
6 ><META
7 NAME="GENERATOR"
8 CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
9 REV="MADE"
10 HREF="mailto:pgsql-docs@postgresql.org"><LINK
11 REL="HOME"
12 TITLE="PostgreSQL 7.4.1 Documentation"
13 HREF="index.html"><LINK
14 REL="UP"
15 TITLE="libpq - C Library"
16 HREF="libpq.html"><LINK
17 REL="PREVIOUS"
18 TITLE="Notice Processing"
19 HREF="libpq-notice-processing.html"><LINK
20 REL="NEXT"
21 TITLE="The Password File"
22 HREF="libpq-pgpass.html"><LINK
23 REL="STYLESHEET"
24 TYPE="text/css"
25 HREF="stylesheet.css"><META
26 NAME="creation"
27 CONTENT="2003-12-22T03:48:47"></HEAD
28 ><BODY
29 CLASS="SECT1"
30 ><DIV
31 CLASS="NAVHEADER"
32 ><TABLE
33 SUMMARY="Header navigation table"
34 WIDTH="100%"
35 BORDER="0"
36 CELLPADDING="0"
37 CELLSPACING="0"
38 ><TR
39 ><TH
40 COLSPAN="5"
41 ALIGN="center"
42 VALIGN="bottom"
43 >PostgreSQL 7.4.1 Documentation</TH
44 ></TR
45 ><TR
46 ><TD
47 WIDTH="10%"
48 ALIGN="left"
49 VALIGN="top"
50 ><A
51 HREF="libpq-notice-processing.html"
52 ACCESSKEY="P"
53 >Prev</A
54 ></TD
55 ><TD
56 WIDTH="10%"
57 ALIGN="left"
58 VALIGN="top"
59 ><A
60 HREF="libpq.html"
61 >Fast Backward</A
62 ></TD
63 ><TD
64 WIDTH="60%"
65 ALIGN="center"
66 VALIGN="bottom"
67 >Chapter 27. <SPAN
68 CLASS="APPLICATION"
69 >libpq</SPAN
70 > - C Library</TD
71 ><TD
72 WIDTH="10%"
73 ALIGN="right"
74 VALIGN="top"
75 ><A
76 HREF="libpq.html"
77 >Fast Forward</A
78 ></TD
79 ><TD
80 WIDTH="10%"
81 ALIGN="right"
82 VALIGN="top"
83 ><A
84 HREF="libpq-pgpass.html"
85 ACCESSKEY="N"
86 >Next</A
87 ></TD
88 ></TR
89 ></TABLE
90 ><HR
91 ALIGN="LEFT"
92 WIDTH="100%"></DIV
93 ><DIV
94 CLASS="SECT1"
95 ><H1
96 CLASS="SECT1"
97 ><A
98 NAME="LIBPQ-ENVARS"
99 >27.10. Environment Variables</A
100 ></H1
101 ><A
102 NAME="AEN21725"
103 ></A
104 ><P
105 >The following environment variables can be used to select default
106 connection parameter values, which will be used by
107 <CODE
108 CLASS="FUNCTION"
109 >PQconnectdb</CODE
110 >, <CODE
111 CLASS="FUNCTION"
112 >PQsetdbLogin</CODE
113 > and
114 <CODE
115 CLASS="FUNCTION"
116 >PQsetdb</CODE
117 > if no value is directly specified by the calling
118 code.  These are useful to avoid hard-coding database connection
119 information into simple client applications, for example.
120
121 <P
122 ></P
123 ></P><UL
124 ><LI
125 ><P
126 ><A
127 NAME="AEN21734"
128 ></A
129 >
130 <TT
131 CLASS="ENVAR"
132 >PGHOST</TT
133 > sets the database server name.
134 If this begins with a slash, it specifies Unix-domain communication
135 rather than TCP/IP communication; the value is the name of the
136 directory in which the socket file is stored (default <TT
137 CLASS="FILENAME"
138 >/tmp</TT
139 >).</P
140 ></LI
141 ><LI
142 ><P
143 ><A
144 NAME="AEN21741"
145 ></A
146 >
147 <TT
148 CLASS="ENVAR"
149 >PGHOSTADDR</TT
150 > specifies the numeric IP address of the database
151 server.  This can be set instead of <TT
152 CLASS="ENVAR"
153 >PGHOST</TT
154 > to avoid DNS
155 lookup overhead. See the documentation of
156 these parameters, under <CODE
157 CLASS="FUNCTION"
158 >PQconnectdb</CODE
159 > above, for details
160 on their interaction.</P
161 ></LI
162 ><LI
163 ><P
164 ><A
165 NAME="AEN21749"
166 ></A
167 >
168 <TT
169 CLASS="ENVAR"
170 >PGPORT</TT
171 > sets the TCP port number or Unix-domain
172 socket file extension for communicating with the
173 <SPAN
174 CLASS="PRODUCTNAME"
175 >PostgreSQL</SPAN
176 > server.</P
177 ></LI
178 ><LI
179 ><P
180 ><A
181 NAME="AEN21756"
182 ></A
183 >
184 <TT
185 CLASS="ENVAR"
186 >PGDATABASE</TT
187 >  sets the 
188 <SPAN
189 CLASS="PRODUCTNAME"
190 >PostgreSQL</SPAN
191 > database name.</P
192 ></LI
193 ><LI
194 ><P
195 ><A
196 NAME="AEN21763"
197 ></A
198 >
199 <TT
200 CLASS="ENVAR"
201 >PGUSER</TT
202 >
203 sets the user name used to connect to the database.</P
204 ></LI
205 ><LI
206 ><P
207 ><A
208 NAME="AEN21769"
209 ></A
210 >
211 <TT
212 CLASS="ENVAR"
213 >PGPASSWORD</TT
214 >
215 sets the password used if the server demands password
216 authentication.  This environment variable is deprecated for security
217 reasons; consider migrating to use the <TT
218 CLASS="FILENAME"
219 >$HOME/.pgpass</TT
220 >
221 file (see <A
222 HREF="libpq-pgpass.html"
223 >Section 27.11</A
224 >).</P
225 ></LI
226 ><LI
227 ><P
228 ><A
229 NAME="AEN21777"
230 ></A
231 >
232 <TT
233 CLASS="ENVAR"
234 >PGSERVICE</TT
235 >
236 sets the service name to be looked up in <TT
237 CLASS="FILENAME"
238 >pg_service.conf</TT
239 >.
240 This offers a shorthand way of setting all the parameters.</P
241 ></LI
242 ><LI
243 ><P
244 ><A
245 NAME="AEN21784"
246 ></A
247 >
248 <TT
249 CLASS="ENVAR"
250 >PGREALM</TT
251 > sets the Kerberos realm to  use  with  
252 <SPAN
253 CLASS="PRODUCTNAME"
254 >PostgreSQL</SPAN
255 >, if  it is different from the local realm.
256 If <TT
257 CLASS="ENVAR"
258 >PGREALM</TT
259 > is set, <SPAN
260 CLASS="APPLICATION"
261 >libpq</SPAN
262 >
263 applications  will  attempt authentication  with  servers for this realm and use
264 separate ticket files to avoid conflicts with  local
265 ticket  files.   This  environment  variable is only
266 used if Kerberos authentication is selected by the server.</P
267 ></LI
268 ><LI
269 ><P
270 ><A
271 NAME="AEN21793"
272 ></A
273 >
274 <TT
275 CLASS="ENVAR"
276 >PGOPTIONS</TT
277 > sets additional run-time  options  for  
278 the <SPAN
279 CLASS="PRODUCTNAME"
280 >PostgreSQL</SPAN
281 > server.</P
282 ></LI
283 ><LI
284 ><P
285 ><A
286 NAME="AEN21800"
287 ></A
288 >
289 <TT
290 CLASS="ENVAR"
291 >PGSSLMODE</TT
292 > determines whether and with what priority an
293 <ACRONYM
294 CLASS="ACRONYM"
295 >SSL</ACRONYM
296 > connection will be negotiated with the server. There are
297 four modes: <TT
298 CLASS="LITERAL"
299 >disable</TT
300 > will attempt only an unencrypted
301 <ACRONYM
302 CLASS="ACRONYM"
303 >SSL</ACRONYM
304 > connection; <TT
305 CLASS="LITERAL"
306 >allow</TT
307 > will negotiate,
308 trying first a non-<ACRONYM
309 CLASS="ACRONYM"
310 >SSL</ACRONYM
311 > connection, then if that fails,
312 trying an <ACRONYM
313 CLASS="ACRONYM"
314 >SSL</ACRONYM
315 > connection; <TT
316 CLASS="LITERAL"
317 >prefer</TT
318 >
319 (the default) will negotiate, trying first an <ACRONYM
320 CLASS="ACRONYM"
321 >SSL</ACRONYM
322 >
323 connection, then if that fails, trying a regular non-<ACRONYM
324 CLASS="ACRONYM"
325 >SSL</ACRONYM
326 >
327 connection; <TT
328 CLASS="LITERAL"
329 >require</TT
330 > will try only an <ACRONYM
331 CLASS="ACRONYM"
332 >SSL</ACRONYM
333 >
334 connection. If <SPAN
335 CLASS="PRODUCTNAME"
336 >PostgreSQL</SPAN
337 > is compiled without SSL support,
338 using option <TT
339 CLASS="LITERAL"
340 >require</TT
341 > will cause an error, and options
342 <TT
343 CLASS="LITERAL"
344 >allow</TT
345 > and <TT
346 CLASS="LITERAL"
347 >prefer</TT
348 > will be tolerated but
349 <SPAN
350 CLASS="APPLICATION"
351 >libpq</SPAN
352 > will be unable to negotiate an <ACRONYM
353 CLASS="ACRONYM"
354 >SSL</ACRONYM
355 >
356 connection.</P
357 ></LI
358 ><LI
359 ><P
360 ><A
361 NAME="AEN21823"
362 ></A
363 >
364 <TT
365 CLASS="ENVAR"
366 >PGREQUIRESSL</TT
367 > sets whether or not the connection must be
368 made over <ACRONYM
369 CLASS="ACRONYM"
370 >SSL</ACRONYM
371 >. If set to
372 <SPAN
373 CLASS="QUOTE"
374 >"1"</SPAN
375 >, <SPAN
376 CLASS="APPLICATION"
377 >libpq</SPAN
378 >
379 will refuse to connect if the server does not accept
380 an <ACRONYM
381 CLASS="ACRONYM"
382 >SSL</ACRONYM
383 > connection (equivalent to <TT
384 CLASS="LITERAL"
385 >sslmode</TT
386 >
387 <TT
388 CLASS="LITERAL"
389 >prefer</TT
390 >).
391 This option is deprecated in favor of the <TT
392 CLASS="LITERAL"
393 >sslmode</TT
394 >
395 setting, and is only available if
396 <SPAN
397 CLASS="PRODUCTNAME"
398 >PostgreSQL</SPAN
399 > is compiled with SSL support.</P
400 ></LI
401 ><LI
402 ><P
403 ><A
404 NAME="AEN21837"
405 ></A
406 >
407 <TT
408 CLASS="ENVAR"
409 >PGCONNECT_TIMEOUT</TT
410 > sets the maximum number of seconds
411 that <SPAN
412 CLASS="APPLICATION"
413 >libpq</SPAN
414 > will wait when attempting to
415 connect to the <SPAN
416 CLASS="PRODUCTNAME"
417 >PostgreSQL</SPAN
418 > server.  If unset
419 or set to zero, <SPAN
420 CLASS="APPLICATION"
421 >libpq</SPAN
422 > will wait indefinitely.
423 It is not recommended to set the timeout to less than 2 seconds.</P
424 ></LI
425 ></UL
426 ><P></P
427 ><P
428 >The following environment variables can be used to specify default
429 behavior for each <SPAN
430 CLASS="PRODUCTNAME"
431 >PostgreSQL</SPAN
432 > session.
433 (See also the <TT
434 CLASS="COMMAND"
435 >ALTER USER</TT
436 > and <TT
437 CLASS="COMMAND"
438 >ALTER DATABASE</TT
439 >
440 commands for ways to set default behavior on a per-user or per-database
441 basis.)
442
443 <P
444 ></P
445 ></P><UL
446 ><LI
447 ><P
448 ><A
449 NAME="AEN21851"
450 ></A
451 >
452 <TT
453 CLASS="ENVAR"
454 >PGDATESTYLE</TT
455 >
456 sets the default style of date/time representation.
457 (Equivalent to <TT
458 CLASS="LITERAL"
459 >SET datestyle TO ...</TT
460 >.)</P
461 ></LI
462 ><LI
463 ><P
464 ><A
465 NAME="AEN21858"
466 ></A
467 >
468 <TT
469 CLASS="ENVAR"
470 >PGTZ</TT
471 >
472 sets the default time zone.
473 (Equivalent to <TT
474 CLASS="LITERAL"
475 >SET timezone TO ...</TT
476 >.)</P
477 ></LI
478 ><LI
479 ><P
480 ><A
481 NAME="AEN21865"
482 ></A
483 >
484 <TT
485 CLASS="ENVAR"
486 >PGCLIENTENCODING</TT
487 >
488 sets the default client character set encoding.
489 (Equivalent to <TT
490 CLASS="LITERAL"
491 >SET client_encoding TO ...</TT
492 >.)</P
493 ></LI
494 ><LI
495 ><P
496 ><A
497 NAME="AEN21872"
498 ></A
499 >
500 <TT
501 CLASS="ENVAR"
502 >PGGEQO</TT
503 >
504 sets the default mode for the genetic query optimizer.
505 (Equivalent to <TT
506 CLASS="LITERAL"
507 >SET geqo TO ...</TT
508 >.)</P
509 ></LI
510 ></UL
511 ><P>
512
513 Refer to the <ACRONYM
514 CLASS="ACRONYM"
515 >SQL</ACRONYM
516 > command <TT
517 CLASS="COMMAND"
518 >SET</TT
519 >
520 for information on correct values for these environment variables.</P
521 ></DIV
522 ><DIV
523 CLASS="NAVFOOTER"
524 ><HR
525 ALIGN="LEFT"
526 WIDTH="100%"><TABLE
527 SUMMARY="Footer navigation table"
528 WIDTH="100%"
529 BORDER="0"
530 CELLPADDING="0"
531 CELLSPACING="0"
532 ><TR
533 ><TD
534 WIDTH="33%"
535 ALIGN="left"
536 VALIGN="top"
537 ><A
538 HREF="libpq-notice-processing.html"
539 ACCESSKEY="P"
540 >Prev</A
541 ></TD
542 ><TD
543 WIDTH="34%"
544 ALIGN="center"
545 VALIGN="top"
546 ><A
547 HREF="index.html"
548 ACCESSKEY="H"
549 >Home</A
550 ></TD
551 ><TD
552 WIDTH="33%"
553 ALIGN="right"
554 VALIGN="top"
555 ><A
556 HREF="libpq-pgpass.html"
557 ACCESSKEY="N"
558 >Next</A
559 ></TD
560 ></TR
561 ><TR
562 ><TD
563 WIDTH="33%"
564 ALIGN="left"
565 VALIGN="top"
566 >Notice Processing</TD
567 ><TD
568 WIDTH="34%"
569 ALIGN="center"
570 VALIGN="top"
571 ><A
572 HREF="libpq.html"
573 ACCESSKEY="U"
574 >Up</A
575 ></TD
576 ><TD
577 WIDTH="33%"
578 ALIGN="right"
579 VALIGN="top"
580 >The Password File</TD
581 ></TR
582 ></TABLE
583 ></DIV
584 ></BODY
585 ></HTML
586 >