3 .\" Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
6 .\" Manual: PostgreSQL 18.0 Documentation
7 .\" Source: PostgreSQL 18.0
10 .TH "SET" "7" "2025" "PostgreSQL 18.0" "PostgreSQL 18.0 Documentation"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
25 .\" disable justification (adjust text to left margin only)
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
31 SET \- change a run\-time parameter
35 SET [ SESSION | LOCAL ] \fIconfiguration_parameter\fR { TO | = } { \fIvalue\fR | \*(Aq\fIvalue\fR\*(Aq | DEFAULT }
36 SET [ SESSION | LOCAL ] TIME ZONE { \fIvalue\fR | \*(Aq\fIvalue\fR\*(Aq | LOCAL | DEFAULT }
42 command changes run\-time configuration parameters\&. Many of the run\-time parameters listed in
44 can be changed on\-the\-fly with
45 \fBSET\fR\&. (Some parameters can only be changed by superusers and users who have been granted
47 privilege on that parameter\&. There are also parameters that cannot be changed after server or session start\&.)
49 only affects the value used by the current session\&.
54 \fBSET SESSION\fR) is issued within a transaction that is later aborted, the effects of the
56 command disappear when the transaction is rolled back\&. Once the surrounding transaction is committed, the effects will persist until the end of the session, unless overridden by another
61 last only till the end of the current transaction, whether committed or not\&. A special case is
65 within a single transaction: the
67 value will be seen until the end of the transaction, but afterwards (if the transaction is committed) the
69 value will take effect\&.
75 are also canceled by rolling back to a savepoint that is earlier than the command\&.
79 is used within a function that has a
81 option for the same variable (see
82 CREATE FUNCTION (\fBCREATE_FUNCTION\fR(7))), the effects of the
84 command disappear at function exit; that is, the value in effect when the function was called is restored anyway\&. This allows
86 to be used for dynamic or repeated changes of a parameter within a function, while still having the convenience of using the
88 option to save and restore the caller\*(Aqs value\&. However, a regular
90 command overrides any surrounding function\*(Aqs
92 option; its effects will persist unless rolled back\&.
98 .nr an-no-space-flag 1
108 versions 8\&.0 through 8\&.2, the effects of a
110 would be canceled by releasing an earlier savepoint, or by successful exit from a
112 exception block\&. This behavior has been changed because it was deemed unintuitive\&.
119 Specifies that the command takes effect for the current session\&. (This is the default if neither
128 Specifies that the command takes effect for only the current transaction\&. After
131 \fBROLLBACK\fR, the session\-level setting takes effect again\&. Issuing this outside of a transaction block emits a warning and otherwise has no effect\&.
134 \fIconfiguration_parameter\fR
136 Name of a settable run\-time parameter\&. Available parameters are documented in
143 New value of parameter\&. Values can be specified as string constants, identifiers, numbers, or comma\-separated lists of these, as appropriate for the particular parameter\&.
145 can be written to specify resetting the parameter to its default value (that is, whatever value it would have had if no
147 had been executed in the current session)\&.
150 Besides the configuration parameters documented in
151 Chapter\ \&19, there are a few that can only be adjusted using the
153 command or that have a special syntax:
157 SET SCHEMA \*(Aq\fIvalue\fR\*(Aq
159 SET search_path TO \fIvalue\fR\&. Only one schema can be specified using this syntax\&.
164 SET NAMES \*(Aq\fIvalue\fR\*(Aq
166 SET client_encoding TO \fIvalue\fR\&.
171 Sets the internal seed for the random number generator (the function
172 \fBrandom\fR)\&. Allowed values are floating\-point numbers between \-1 and 1 inclusive\&.
174 The seed can also be set by invoking the function
181 SELECT setseed(\fIvalue\fR);
190 SET TIME ZONE \*(Aq\fIvalue\fR\*(Aq
192 SET timezone TO \*(Aq\fIvalue\fR\*(Aq\&. The syntax
194 allows special syntax for the time zone specification\&. Here are examples of valid values:
196 \*(AqAmerica/Los_Angeles\*(Aq
198 The time zone for Berkeley, California\&.
201 \*(AqEurope/Rome\*(Aq
203 The time zone for Italy\&.
208 The time zone 7 hours west from UTC (equivalent to PDT)\&. Positive values are east from UTC\&.
211 INTERVAL \*(Aq\-08:00\*(Aq HOUR TO MINUTE
213 The time zone 8 hours west from UTC (equivalent to PST)\&.
220 Set the time zone to your local time zone (that is, the server\*(Aqs default value of
224 Timezone settings given as numbers or intervals are internally translated to POSIX timezone syntax\&. For example, after
230 Time zone abbreviations are not supported by
233 for more information about time zones\&.
239 provides equivalent functionality; see
240 Section\ \&9.28.1\&. Also, it is possible to UPDATE the
242 system view to perform the equivalent of
246 Set the schema search path:
252 SET search_path TO my_schema, public;
258 Set the style of date to traditional
261 \(lqday before month\(rq
268 SET datestyle TO postgres, dmy;
274 Set the time zone for Berkeley, California:
280 SET TIME ZONE \*(AqAmerica/Los_Angeles\*(Aq;
286 Set the time zone for Italy:
292 SET TIME ZONE \*(AqEurope/Rome\*(Aq;
300 extends syntax defined in the SQL standard\&. The standard allows only numeric time zone offsets while
302 allows more flexible time\-zone specifications\&. All other
308 \fBRESET\fR(7), \fBSHOW\fR(7)