Skip to content

Commit 029aa97

Browse files
committed
Make sure all clients have the same understanding of default user name
and database. In particular, make script wrappers understand the PGDATABASE environment variable.
1 parent 60ac5b8 commit 029aa97

19 files changed

+74
-161
lines changed

doc/src/sgml/ref/createdb.sgml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/createdb.sgml,v 1.27 2002/07/28 15:22:20 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/createdb.sgml,v 1.28 2002/08/10 16:57:31 petere Exp $
33
PostgreSQL documentation
44
-->
55

@@ -237,6 +237,16 @@ PostgreSQL documentation
237237
<title>Environment</title>
238238

239239
<variablelist>
240+
<varlistentry>
241+
<term><envar>PGDATABASE</envar></term>
242+
<listitem>
243+
<para>
244+
If set, the name of the database to create, unless overridden on
245+
the command line.
246+
</para>
247+
</listitem>
248+
</varlistentry>
249+
240250
<varlistentry>
241251
<term><envar>PGHOST</envar></term>
242252
<term><envar>PGPORT</envar></term>
@@ -246,7 +256,7 @@ PostgreSQL documentation
246256
<para>
247257
Default connection parameters. <envar>PGUSER</envar> also
248258
determines the name of the database to create, if it is not
249-
specified in the command line.
259+
specified on the command line or by <envar>PGDATABASE</envar>.
250260
</para>
251261
</listitem>
252262
</varlistentry>
@@ -257,7 +267,6 @@ PostgreSQL documentation
257267
<refsect1 id="R1-APP-CREATEDB-2">
258268
<title>Examples</title>
259269

260-
<informalexample>
261270
<para>
262271
To create the database <literal>demo</literal> using the default
263272
database server:
@@ -268,9 +277,7 @@ PostgreSQL documentation
268277
The response is the same as you would have gotten from running the
269278
<command>CREATE DATABASE</command> <acronym>SQL</acronym> command.
270279
</para>
271-
</informalexample>
272280

273-
<informalexample>
274281
<para>
275282
To create the database <literal>demo</literal> using the
276283
server on host <literal>eden</>, port 5000, using the
@@ -282,7 +289,6 @@ PostgreSQL documentation
282289
<computeroutput>CREATE DATABASE</computeroutput>
283290
</screen>
284291
</para>
285-
</informalexample>
286292
</refsect1>
287293

288294

doc/src/sgml/ref/createlang.sgml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/createlang.sgml,v 1.25 2002/07/28 15:22:20 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/createlang.sgml,v 1.26 2002/08/10 16:57:31 petere Exp $
33
PostgreSQL documentation
44
-->
55

@@ -168,6 +168,7 @@ PostgreSQL documentation
168168

169169
<variablelist>
170170
<varlistentry>
171+
<term><envar>PGDATABASE</envar></term>
171172
<term><envar>PGHOST</envar></term>
172173
<term><envar>PGPORT</envar></term>
173174
<term><envar>PGUSER</envar></term>
@@ -214,15 +215,13 @@ PostgreSQL documentation
214215
<refsect1>
215216
<title>Examples</title>
216217

217-
<informalexample>
218218
<para>
219219
To install <literal>pltcl</literal> into the database
220220
<literal>template1</literal>:
221221
<screen>
222222
<prompt>$ </prompt><userinput>createlang pltcl template1</userinput>
223223
</screen>
224224
</para>
225-
</informalexample>
226225
</refsect1>
227226

228227
<refsect1>

doc/src/sgml/ref/createuser.sgml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/createuser.sgml,v 1.26 2002/07/28 15:22:20 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/createuser.sgml,v 1.27 2002/08/10 16:57:31 petere Exp $
33
PostgreSQL documentation
44
-->
55

@@ -128,7 +128,7 @@ PostgreSQL documentation
128128
<listitem>
129129
<para>
130130
The new user is allowed to create other users.
131-
(Note: actually, this makes the new user a <firstterm>superuser</>.
131+
(Note: Actually, this makes the new user a <firstterm>superuser</>.
132132
The option is poorly named.)
133133
</para>
134134
</listitem>
@@ -264,7 +264,6 @@ PostgreSQL documentation
264264
<refsect1>
265265
<title>Examples</title>
266266

267-
<informalexample>
268267
<para>
269268
To create a user <literal>joe</literal> on the default database
270269
server:
@@ -275,9 +274,7 @@ PostgreSQL documentation
275274
<computeroutput>CREATE USER</computeroutput>
276275
</screen>
277276
</para>
278-
</informalexample>
279277

280-
<informalexample>
281278
<para>
282279
To create the same user <literal>joe</literal> using the
283280
server on host <literal>eden</>, port 5000, avoiding the prompts and
@@ -288,7 +285,6 @@ PostgreSQL documentation
288285
<computeroutput>CREATE USER</computeroutput>
289286
</screen>
290287
</para>
291-
</informalexample>
292288
</refsect1>
293289

294290

doc/src/sgml/ref/dropdb.sgml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/dropdb.sgml,v 1.16 2002/07/28 15:22:20 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/dropdb.sgml,v 1.17 2002/08/10 16:57:31 petere Exp $
33
PostgreSQL documentation
44
-->
55

@@ -191,7 +191,6 @@ PostgreSQL documentation
191191
<refsect1 id="R1-APP-DROPDB-2">
192192
<title>Examples</title>
193193

194-
<informalexample>
195194
<para>
196195
To destroy the database <literal>demo</literal> on the default
197196
database server:
@@ -200,9 +199,7 @@ PostgreSQL documentation
200199
<computeroutput>DROP DATABASE</computeroutput>
201200
</screen>
202201
</para>
203-
</informalexample>
204202

205-
<informalexample>
206203
<para>
207204
To destroy the database <literal>demo</literal> using the
208205
server on host <literal>eden</literal>, port 5000, with verification and a peek
@@ -215,7 +212,6 @@ Are you sure? (y/n) </computeroutput><userinput>y</userinput>
215212
DROP DATABASE</computeroutput>
216213
</screen>
217214
</para>
218-
</informalexample>
219215
</refsect1>
220216

221217

doc/src/sgml/ref/droplang.sgml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/droplang.sgml,v 1.19 2002/07/28 15:22:20 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/droplang.sgml,v 1.20 2002/08/10 16:57:31 petere Exp $
33
PostgreSQL documentation
44
-->
55

@@ -157,6 +157,7 @@ PostgreSQL documentation
157157

158158
<variablelist>
159159
<varlistentry>
160+
<term><envar>PGDATABASE</envar></term>
160161
<term><envar>PGHOST</envar></term>
161162
<term><envar>PGPORT</envar></term>
162163
<term><envar>PGUSER</envar></term>
@@ -196,14 +197,12 @@ PostgreSQL documentation
196197
<refsect1>
197198
<title>Examples</title>
198199

199-
<informalexample>
200200
<para>
201201
To remove <literal>pltcl</literal>:
202202
<screen>
203203
<prompt>$ </prompt><userinput>droplang pltcl dbname</userinput>
204204
</screen>
205205
</para>
206-
</informalexample>
207206
</refsect1>
208207

209208
<refsect1>

doc/src/sgml/ref/dropuser.sgml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/dropuser.sgml,v 1.19 2002/07/28 15:22:20 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/dropuser.sgml,v 1.20 2002/08/10 16:57:31 petere Exp $
33
PostgreSQL documentation
44
-->
55

@@ -181,7 +181,6 @@ PostgreSQL documentation
181181
<refsect1>
182182
<title>Examples</title>
183183

184-
<informalexample>
185184
<para>
186185
To remove user <literal>joe</literal> from the default database
187186
server:
@@ -190,9 +189,7 @@ PostgreSQL documentation
190189
<computeroutput>DROP USER</computeroutput>
191190
</screen>
192191
</para>
193-
</informalexample>
194192

195-
<informalexample>
196193
<para>
197194
To remove user <literal>joe</literal> using the postmaster on host
198195
<literal>eden</literal>, port 5000, with verification and a peek at the underlying
@@ -205,7 +202,6 @@ Are you sure? (y/n) </computeroutput><userinput>y</userinput>
205202
DROP USER</computeroutput>
206203
</screen>
207204
</para>
208-
</informalexample>
209205
</refsect1>
210206

211207

doc/src/sgml/ref/pg_dump.sgml

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dump.sgml,v 1.46 2002/07/28 15:22:20 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dump.sgml,v 1.47 2002/08/10 16:57:31 petere Exp $
33
PostgreSQL documentation
44
-->
55

@@ -43,7 +43,7 @@ PostgreSQL documentation
4343
<arg>-p <replaceable>port</replaceable></arg>
4444
<arg>-U <replaceable>username</replaceable></arg>
4545
<arg>-W</arg>
46-
<arg choice="plain"><replaceable>dbname</replaceable></arg>
46+
<arg><replaceable>dbname</replaceable></arg>
4747
</cmdsynopsis>
4848
</refsynopsisdiv>
4949

@@ -126,7 +126,10 @@ PostgreSQL documentation
126126
<term><replaceable class="parameter">dbname</replaceable></term>
127127
<listitem>
128128
<para>
129-
Specifies the name of the database to be dumped.
129+
Specifies the name of the database to be dumped. If this is
130+
not specified, the environment variable
131+
<envar>PGDATABASE</envar> is used. If that is not set, the
132+
user name specified for the connection is used.
130133
</para>
131134
</listitem>
132135
</varlistentry>
@@ -562,7 +565,7 @@ PostgreSQL documentation
562565
<term><option>-U <replaceable>username</replaceable></option></term>
563566
<listitem>
564567
<para>
565-
Connect as the given user.
568+
Connect as the given user
566569
</para>
567570
</listitem>
568571
</varlistentry>
@@ -588,15 +591,6 @@ PostgreSQL documentation
588591
<variablelist>
589592
<varlistentry>
590593
<term><envar>PGDATABASE</envar></term>
591-
592-
<listitem>
593-
<para>
594-
Database to dump, unless overridden on the command line.
595-
</para>
596-
</listitem>
597-
</varlistentry>
598-
599-
<varlistentry>
600594
<term><envar>PGHOST</envar></term>
601595
<term><envar>PGPORT</envar></term>
602596
<term><envar>PGUSER</envar></term>

doc/src/sgml/ref/pg_restore.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_restore.sgml,v 1.29 2002/07/28 15:22:20 petere Exp $ -->
1+
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_restore.sgml,v 1.30 2002/08/10 16:57:31 petere Exp $ -->
22

33
<refentry id="APP-PGRESTORE">
44
<docinfo>
@@ -475,7 +475,7 @@
475475
<term><option>-U <replaceable>username</replaceable></option></term>
476476
<listitem>
477477
<para>
478-
Connect as the given user.
478+
Connect as the given user
479479
</para>
480480
</listitem>
481481
</varlistentry>

doc/src/sgml/ref/vacuumdb.sgml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/vacuumdb.sgml,v 1.22 2002/07/28 15:22:21 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/vacuumdb.sgml,v 1.23 2002/08/10 16:57:31 petere Exp $
33
PostgreSQL documentation
44
-->
55

@@ -75,6 +75,11 @@ PostgreSQL documentation
7575
<listitem>
7676
<para>
7777
Specifies the name of the database to be cleaned or analyzed.
78+
If this is not specified and <option>-a</option> (or
79+
<option>--all</option>) is not used, the database name is read
80+
from the environment variable <envar>PGDATABASE</envar>. If
81+
that is not set, the user name specified for the connection is
82+
used.
7883
</para>
7984
</listitem>
8085
</varlistentry>
@@ -251,6 +256,7 @@ PostgreSQL documentation
251256

252257
<variablelist>
253258
<varlistentry>
259+
<term><envar>PGDATABASE</envar></term>
254260
<term><envar>PGHOST</envar></term>
255261
<term><envar>PGPORT</envar></term>
256262
<term><envar>PGUSER</envar></term>
@@ -268,26 +274,21 @@ PostgreSQL documentation
268274
<refsect1>
269275
<title>Examples</title>
270276

271-
<informalexample>
272277
<para>
273278
To clean the database <literal>test</literal>:
274279
<screen>
275280
<prompt>$ </prompt><userinput>vacuumdb test</userinput>
276281
</screen>
277282
</para>
278-
</informalexample>
279283

280-
<informalexample>
281284
<para>
282285
To clean and analyze for the optimizer a database named
283286
<literal>bigdb</literal>:
284287
<screen>
285288
<prompt>$ </prompt><userinput>vacuumdb --analyze bigdb</userinput>
286289
</screen>
287290
</para>
288-
</informalexample>
289291

290-
<informalexample>
291292
<para>
292293
To clean a single table
293294
<literal>foo</literal> in a database named
@@ -297,7 +298,6 @@ PostgreSQL documentation
297298
<prompt>$ </prompt><userinput>vacuumdb --analyze --verbose --table 'foo(bar)' xyzzy</userinput>
298299
</screen>
299300
</para>
300-
</informalexample>
301301

302302
</refsect1>
303303

0 commit comments

Comments
 (0)