455
455
any, by an equal sign on the command line. To unset a variable,
456
456
leave off the equal sign. To set a variable with an empty value,
457
457
use the equal sign but leave off the value. These assignments are
458
- done during a very early stage of start-up , so variables reserved
459
- for internal purposes might get overwritten later.
458
+ done during command line processing , so variables that reflect
459
+ connection state will get overwritten later.
460
460
</para>
461
461
</listitem>
462
462
</varlistentry>
@@ -2692,7 +2692,7 @@ lo_import 152801
2692
2692
class="parameter">name</replaceable> to <replaceable
2693
2693
class="parameter">value</replaceable>, or if more than one value
2694
2694
is given, to the concatenation of all of them. If only one
2695
- argument is given, the variable is set with an empty value. To
2695
+ argument is given, the variable is set to an empty-string value. To
2696
2696
unset a variable, use the <command>\unset</command> command.
2697
2697
</para>
2698
2698
@@ -2709,9 +2709,11 @@ lo_import 152801
2709
2709
</para>
2710
2710
2711
2711
<para>
2712
- Although you are welcome to set any variable to anything you
2713
- want, <application>psql</application> treats several variables
2714
- as special. They are documented in the section about variables.
2712
+ Certain variables are special, in that they
2713
+ control <application>psql</application>'s behavior or are
2714
+ automatically set to reflect connection state. These variables are
2715
+ documented in <xref linkend="APP-PSQL-variables"
2716
+ endterm="APP-PSQL-variables-title">, below.
2715
2717
</para>
2716
2718
2717
2719
<note>
@@ -2835,6 +2837,14 @@ testdb=> <userinput>\setenv LESS -imx4F</userinput>
2835
2837
Unsets (deletes) the <application>psql</> variable <replaceable
2836
2838
class="parameter">name</replaceable>.
2837
2839
</para>
2840
+
2841
+ <para>
2842
+ Most variables that control <application>psql</application>'s behavior
2843
+ cannot be unset; instead, an <literal>\unset</> command is interpreted
2844
+ as setting them to their default values.
2845
+ See <xref linkend="APP-PSQL-variables"
2846
+ endterm="APP-PSQL-variables-title">, below.
2847
+ </para>
2838
2848
</listitem>
2839
2849
</varlistentry>
2840
2850
@@ -3053,7 +3063,7 @@ bar
3053
3063
3054
3064
<para>
3055
3065
If you call <command>\set</command> without a second argument, the
3056
- variable is set, with an empty string as value. To unset (i.e., delete)
3066
+ variable is set to an empty- string value. To unset (i.e., delete)
3057
3067
a variable, use the command <command>\unset</command>. To show the
3058
3068
values of all variables, call <command>\set</command> without any argument.
3059
3069
</para>
@@ -3082,8 +3092,23 @@ bar
3082
3092
By convention, all specially treated variables' names
3083
3093
consist of all upper-case ASCII letters (and possibly digits and
3084
3094
underscores). To ensure maximum compatibility in the future, avoid
3085
- using such variable names for your own purposes. A list of all specially
3086
- treated variables follows.
3095
+ using such variable names for your own purposes.
3096
+ </para>
3097
+
3098
+ <para>
3099
+ Variables that control <application>psql</application>'s behavior
3100
+ generally cannot be unset or set to invalid values. An <literal>\unset</>
3101
+ command is allowed but is interpreted as setting the variable to its
3102
+ default value. A <literal>\set</> command without a second argument is
3103
+ interpreted as setting the variable to <literal>on</>, for control
3104
+ variables that accept that value, and is rejected for others. Also,
3105
+ control variables that accept the values <literal>on</>
3106
+ and <literal>off</> will also accept other common spellings of Boolean
3107
+ values, such as <literal>true</> and <literal>false</>.
3108
+ </para>
3109
+
3110
+ <para>
3111
+ The specially treated variables are:
3087
3112
</para>
3088
3113
3089
3114
<variablelist>
@@ -3153,7 +3178,7 @@ bar
3153
3178
<para>
3154
3179
The name of the database you are currently connected to. This is
3155
3180
set every time you connect to a database (including program
3156
- start-up), but can be unset.
3181
+ start-up), but can be changed or unset.
3157
3182
</para>
3158
3183
</listitem>
3159
3184
</varlistentry>
@@ -3171,8 +3196,8 @@ bar
3171
3196
as it is sent to the server. The switch to select this behavior is
3172
3197
<option>-e</option>. If set to <literal>errors</literal>, then only
3173
3198
failed queries are displayed on standard error output. The switch
3174
- for this behavior is <option>-b</option>. If unset, or if set to
3175
- <literal>none</literal>, then no queries are displayed.
3199
+ for this behavior is <option>-b</option>. If set to
3200
+ <literal>none</literal> (the default) , then no queries are displayed.
3176
3201
</para>
3177
3202
</listitem>
3178
3203
</varlistentry>
@@ -3187,8 +3212,9 @@ bar
3187
3212
<productname>PostgreSQL</productname> internals and provide
3188
3213
similar functionality in your own programs. (To select this behavior
3189
3214
on program start-up, use the switch <option>-E</option>.) If you set
3190
- the variable to the value <literal>noexec</literal>, the queries are
3215
+ this variable to the value <literal>noexec</literal>, the queries are
3191
3216
just shown but are not actually sent to the server and executed.
3217
+ The default value is <literal>off</>.
3192
3218
</para>
3193
3219
</listitem>
3194
3220
</varlistentry>
@@ -3200,7 +3226,7 @@ bar
3200
3226
The current client character set encoding.
3201
3227
This is set every time you connect to a database (including
3202
3228
program start-up), and when you change the encoding
3203
- with <literal>\encoding</>, but it can be unset.
3229
+ with <literal>\encoding</>, but it can be changed or unset.
3204
3230
</para>
3205
3231
</listitem>
3206
3232
</varlistentry>
@@ -3209,7 +3235,7 @@ bar
3209
3235
<term><varname>FETCH_COUNT</varname></term>
3210
3236
<listitem>
3211
3237
<para>
3212
- If this variable is set to an integer value > 0 ,
3238
+ If this variable is set to an integer value greater than zero ,
3213
3239
the results of <command>SELECT</command> queries are fetched
3214
3240
and displayed in groups of that many rows, rather than the
3215
3241
default behavior of collecting the entire result set before
@@ -3220,6 +3246,13 @@ bar
3220
3246
Keep in mind that when using this feature, a query might
3221
3247
fail after having already displayed some rows.
3222
3248
</para>
3249
+
3250
+ <para>
3251
+ <varname>FETCH_COUNT</varname> is ignored if it is unset or does not
3252
+ have a positive value. It cannot be set to a value that is not
3253
+ syntactically an integer.
3254
+ </para>
3255
+
3223
3256
<tip>
3224
3257
<para>
3225
3258
Although you can use any output format with this feature,
@@ -3241,7 +3274,7 @@ bar
3241
3274
list. If set to a value of <literal>ignoredups</literal>, lines
3242
3275
matching the previous history line are not entered. A value of
3243
3276
<literal>ignoreboth</literal> combines the two options. If
3244
- unset, or if set to <literal>none</literal> (the default), all lines
3277
+ set to <literal>none</literal> (the default), all lines
3245
3278
read in interactive mode are saved on the history list.
3246
3279
</para>
3247
3280
<note>
@@ -3257,8 +3290,12 @@ bar
3257
3290
<term><varname>HISTFILE</varname></term>
3258
3291
<listitem>
3259
3292
<para>
3260
- The file name that will be used to store the history list. The default
3261
- value is <filename>~/.psql_history</filename>. For example, putting:
3293
+ The file name that will be used to store the history list. If unset,
3294
+ the file name is taken from the <envar>PSQL_HISTORY</envar>
3295
+ environment variable. If that is not set either, the default
3296
+ is <filename>~/.psql_history</filename>,
3297
+ or <filename>%APPDATA%\postgresql\psql_history</filename> on Windows.
3298
+ For example, putting:
3262
3299
<programlisting>
3263
3300
\set HISTFILE ~/.psql_history- :DBNAME
3264
3301
</programlisting>
@@ -3279,8 +3316,10 @@ bar
3279
3316
<term><varname>HISTSIZE</varname></term>
3280
3317
<listitem>
3281
3318
<para>
3282
- The number of commands to store in the command history. The
3283
- default value is 500.
3319
+ The maximum number of commands to store in the command history.
3320
+ If unset, at most 500 commands are stored by default.
3321
+ If set to a value that is negative or not an integer, no limit is
3322
+ applied.
3284
3323
</para>
3285
3324
<note>
3286
3325
<para>
@@ -3297,7 +3336,7 @@ bar
3297
3336
<para>
3298
3337
The database server host you are currently connected to. This is
3299
3338
set every time you connect to a database (including program
3300
- start-up), but can be unset.
3339
+ start-up), but can be changed or unset.
3301
3340
</para>
3302
3341
</listitem>
3303
3342
</varlistentry>
@@ -3350,7 +3389,7 @@ bar
3350
3389
generates an error, the error is ignored and the transaction
3351
3390
continues. When set to <literal>interactive</>, such errors are only
3352
3391
ignored in interactive sessions, and not when reading script
3353
- files. When unset or set to <literal>off</>, a statement in a
3392
+ files. When set to <literal>off</> (the default) , a statement in a
3354
3393
transaction block that generates an error aborts the entire
3355
3394
transaction. The error rollback mode works by issuing an
3356
3395
implicit <command>SAVEPOINT</> for you, just before each command
@@ -3385,7 +3424,7 @@ bar
3385
3424
<para>
3386
3425
The database server port to which you are currently connected.
3387
3426
This is set every time you connect to a database (including
3388
- program start-up), but can be unset.
3427
+ program start-up), but can be changed or unset.
3389
3428
</para>
3390
3429
</listitem>
3391
3430
</varlistentry>
@@ -3458,7 +3497,7 @@ bar
3458
3497
<para>
3459
3498
The database user you are currently connected as. This is set
3460
3499
every time you connect to a database (including program
3461
- start-up), but can be unset.
3500
+ start-up), but can be changed or unset.
3462
3501
</para>
3463
3502
</listitem>
3464
3503
</varlistentry>
@@ -3481,7 +3520,7 @@ bar
3481
3520
<listitem>
3482
3521
<para>
3483
3522
This variable is set at program start-up to
3484
- reflect <application>psql</>'s version. It can be unset or changed .
3523
+ reflect <application>psql</>'s version. It can be changed or unset .
3485
3524
</para>
3486
3525
</listitem>
3487
3526
</varlistentry>
@@ -4015,6 +4054,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
4015
4054
</para>
4016
4055
<para>
4017
4056
The location of the history file can be set explicitly via
4057
+ the <varname>HISTFILE</varname> <application>psql</> variable or
4018
4058
the <envar>PSQL_HISTORY</envar> environment variable.
4019
4059
</para>
4020
4060
</listitem>
0 commit comments