Set

Set runtime variables.

Synopsis

SET variable { TO | = } { value | 'value' | DEFAULT }
SET TIME ZONE { 'timezone' | LOCAL | DEFAULT }

Parameters

variable

The name of the runtime variable you are setting.

value

A new value for the specified variable. Use DEFAULT to reset the variable to its default value.

timezone

The time zone of the client. The following are a few valid time zone values:

PST8PDT

Pacific Standard/Daylight Savings Time (GMT offset by 8 hours).

EST5EDT

Eastern Standard/Daylight Savings Time (GMT offset by 5 hours).

NZST13NZDT

Standard/daylight savings time zone in New Zealand (GMT offset by 13 hours).

LOCAL

The clause to set the time zone to the local system’s configured time zone.

DEFAULT

The clause to set a variable value, or a time zone value, to its default.

Results

SET VARIABLE

The message returned when a variable is successfully set.

ERROR: not a valid option name:(name)

The error returned if you try to set a variable that doesn’t exist.

ERROR: permission denied

The error returned if you do not have adequate permissions to alter the specified variable.

ERROR: name can only be set at start-up

The error returned if you attempt to set a variable that can only set set upon startup.

Description

Use the SET command to modify PostgreSQL runtime configuration variables. The following variable can be altered:

CLIENT_ENCODING

The multibyte client encoding scheme (if enabled in PostgreSQL).

DATESTYLE

This variable sets the date and time representation style. When setting this variable, you can choose ...

Get Practical PostgreSQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.