Skip to content

Commit 6870843

Browse files
committed
Add PGETC (for pg_service.conf) and PGLOCALE (for locale dir)
environment variable processing to libpq. The patch also adds code to our client apps so we set the environment variable directly based on our binary location, unless it is already set. This will allow our applications to emit proper locale messages that are generated in libpq.
1 parent 70f5a87 commit 6870843

File tree

22 files changed

+88
-52
lines changed

22 files changed

+88
-52
lines changed

doc/src/sgml/libpq.sgml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.155 2004/05/14 18:04:02 neilc Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.156 2004/06/03 00:07:35 momjian Exp $
33
-->
44

55
<chapter id="libpq">
@@ -3582,6 +3582,24 @@ sets the default mode for the genetic query optimizer.
35823582
(Equivalent to <literal>SET geqo TO ...</literal>.)
35833583
</para>
35843584
</listitem>
3585+
<listitem>
3586+
<para>
3587+
<indexterm>
3588+
<primary><envar>PGETC</envar></primary>
3589+
</indexterm>
3590+
<envar>PGETC</envar>
3591+
sets the directory containing the <filename>pg_service.conf</> file.
3592+
</para>
3593+
</listitem>
3594+
<listitem>
3595+
<para>
3596+
<indexterm>
3597+
<primary><envar>PGLOCALE</envar></primary>
3598+
</indexterm>
3599+
<envar>PGLOCALE</envar>
3600+
sets the directory containing the <literal>locale</> files.
3601+
</para>
3602+
</listitem>
35853603
</itemizedlist>
35863604

35873605
Refer to the <acronym>SQL</acronym> command <command>SET</command>

src/backend/main/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
*
1515
* IDENTIFICATION
16-
* $PostgreSQL: pgsql/src/backend/main/main.c,v 1.85 2004/05/29 22:48:19 tgl Exp $
16+
* $PostgreSQL: pgsql/src/backend/main/main.c,v 1.86 2004/06/03 00:07:36 momjian Exp $
1717
*
1818
*-------------------------------------------------------------------------
1919
*/
@@ -152,7 +152,7 @@ main(int argc, char *argv[])
152152
* allow startup error messages to be localized.
153153
*/
154154

155-
set_pglocale(argv[0], "postgres");
155+
set_pglocale_pgservice(argv[0], "postgres");
156156

157157
#ifdef WIN32
158158

src/bin/initdb/initdb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* Portions Copyright (c) 1994, Regents of the University of California
4040
* Portions taken from FreeBSD.
4141
*
42-
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.34 2004/06/01 02:53:59 momjian Exp $
42+
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.35 2004/06/03 00:07:36 momjian Exp $
4343
*
4444
*-------------------------------------------------------------------------
4545
*/
@@ -1788,7 +1788,7 @@ main(int argc, char *argv[])
17881788
{"global", "pg_xlog", "pg_clog", "base", "base/1"};
17891789

17901790
progname = get_progname(argv[0]);
1791-
set_pglocale(argv[0], "initdb");
1791+
set_pglocale_pgservice(argv[0], "initdb");
17921792

17931793
if (argc > 1)
17941794
{

src/bin/pg_controldata/pg_controldata.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* copyright (c) Oliver Elphick <olly@lfix.co.uk>, 2001;
77
* licence: BSD
88
*
9-
* $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.16 2004/05/25 01:00:23 momjian Exp $
9+
* $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.17 2004/06/03 00:07:36 momjian Exp $
1010
*/
1111
#include "postgres.h"
1212

@@ -77,7 +77,7 @@ main(int argc, char *argv[])
7777
char *strftime_fmt = "%c";
7878
const char *progname;
7979

80-
set_pglocale(argv[0], "pg_controldata");
80+
set_pglocale_pgservice(argv[0], "pg_controldata");
8181

8282
progname = get_progname(argv[0]);
8383

src/bin/pg_ctl/pg_ctl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
66
*
7-
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.5 2004/06/01 22:03:18 momjian Exp $
7+
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.6 2004/06/03 00:07:36 momjian Exp $
88
*
99
*-------------------------------------------------------------------------
1010
*/
@@ -824,7 +824,7 @@ main(int argc, char **argv)
824824
#endif
825825

826826
progname = get_progname(argv[0]);
827-
set_pglocale(argv[0], "pg_ctl");
827+
set_pglocale_pgservice(argv[0], "pg_ctl");
828828

829829
/*
830830
* save argv[0] so do_start() can look for the postmaster if

src/bin/pg_dump/pg_dump.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* by PostgreSQL
1313
*
1414
* IDENTIFICATION
15-
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.372 2004/05/26 18:24:22 momjian Exp $
15+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.373 2004/06/03 00:07:36 momjian Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -242,7 +242,7 @@ main(int argc, char **argv)
242242
};
243243
int optindex;
244244

245-
set_pglocale(argv[0], "pg_dump");
245+
set_pglocale_pgservice(argv[0], "pg_dump");
246246

247247
g_verbose = false;
248248

src/bin/pg_dump/pg_dumpall.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1994, Regents of the University of California
77
*
88
*
9-
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.35 2004/05/25 01:00:24 momjian Exp $
9+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.36 2004/06/03 00:07:36 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -101,7 +101,7 @@ main(int argc, char *argv[])
101101

102102
int optindex;
103103

104-
set_pglocale(argv[0], "pg_dump");
104+
set_pglocale_pgservice(argv[0], "pg_dump");
105105

106106
progname = get_progname(argv[0]);
107107

src/bin/pg_dump/pg_restore.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
*
3535
*
3636
* IDENTIFICATION
37-
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_restore.c,v 1.57 2004/05/25 01:00:24 momjian Exp $
37+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_restore.c,v 1.58 2004/06/03 00:07:37 momjian Exp $
3838
*
3939
*-------------------------------------------------------------------------
4040
*/
@@ -121,7 +121,7 @@ main(int argc, char **argv)
121121
{NULL, 0, NULL, 0}
122122
};
123123

124-
set_pglocale(argv[0], "pg_dump");
124+
set_pglocale_pgservice(argv[0], "pg_dump");
125125

126126
opts = NewRestoreOptions();
127127

src/bin/pg_resetxlog/pg_resetxlog.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
2424
* Portions Copyright (c) 1994, Regents of the University of California
2525
*
26-
* $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.19 2004/05/25 01:00:25 momjian Exp $
26+
* $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.20 2004/06/03 00:07:37 momjian Exp $
2727
*
2828
*-------------------------------------------------------------------------
2929
*/
@@ -102,7 +102,7 @@ main(int argc, char *argv[])
102102
int fd;
103103
char path[MAXPGPATH];
104104

105-
set_pglocale(argv[0], "pg_resetxlog");
105+
set_pglocale_pgservice(argv[0], "pg_resetxlog");
106106

107107
progname = get_progname(argv[0]);
108108

src/bin/psql/startup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.94 2004/05/25 01:00:26 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.95 2004/06/03 00:07:37 momjian Exp $
77
*/
88
#include "postgres_fe.h"
99

@@ -102,7 +102,7 @@ main(int argc, char *argv[])
102102
char *password = NULL;
103103
bool need_pass;
104104

105-
set_pglocale(argv[0], "psql");
105+
set_pglocale_pgservice(argv[0], "psql");
106106

107107
pset.progname = get_progname(argv[0]);
108108

0 commit comments

Comments
 (0)