The SET command allows you to change various POSTGRESQL
parameters. The changes remain in effect for the duration of the database connection.
Table shows two common parameters that can be controlled
with SET.
|
The SET DATESTYLE command controls
the appearance of dates when printed in psql, as seen in Table .
|
The TIMEZONE defaults to the time zone of the server or the PGTZ environment variable. The psql client might be in a different time zone, so SET TIMEZONE allows this parameter to be changed inside psql. See the SET manual page for a full list of SET options.
The SHOW command is used to display the current database session parameters. The RESET command allows a session parameter to be reset to its default value. Figure shows examples of these commands.9.5
test=> SHOW DATESTYLE;
NOTICE: DateStyle is ISO with US (NonEuropean) conventions
SHOW VARIABLE
test=> SET DATESTYLE TO 'SQL, EUROPEAN';
SET VARIABLE
test=> SHOW DATESTYLE;
NOTICE: DateStyle is SQL with European conventions
SHOW VARIABLE
test=> RESET DATESTYLE;
RESET VARIABLE
test=> SHOW DATESTYLE;
NOTICE: DateStyle is ISO with US (NonEuropean) conventions
SHOW VARIABLE