SET
Changes the value of a Greengage DB configuration parameter.
Synopsis
SET [SESSION | LOCAL] <configuration_parameter> { TO | = } {<value> | '<value>' | DEFAULT}
SET [SESSION | LOCAL] TIME ZONE {<timezone> | LOCAL | DEFAULT}
Description
The SET command changes server configuration parameters. Any configuration parameter classified as a session parameter can be changed on-the-fly with SET. SET affects only the value used by the current session.
If SET or SET SESSION is issued within a transaction that is later cancelled, the effects of the SET 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 SET.
The effects of SET LOCAL last only till the end of the current transaction, whether committed or not. A special case is SET followed by SET LOCAL within a single transaction: the SET LOCAL value will be seen until the end of the transaction, but afterward (if the transaction is committed) the SET value will take effect.
If SET LOCAL is used within a function that includes a SET option for the same configuration parameter (see CREATE FUNCTION), the effects of the SET LOCAL command disappear at function exit; the value in effect when the function was called is restored anyway. This allows SET LOCAL to be used for dynamic or repeated changes of a parameter within a function, while retaining the convenience of using the SET option to save and restore the caller’s value. Note that a regular SET command overrides any surrounding function’s SET option; its effects persist unless rolled back.
If you create a cursor with the DECLARE command in a transaction, you cannot use the SET command in the transaction until you close the cursor with the CLOSE command.
See Configure DBMS via GUCs for information about server parameters.
Parameters
| Parameter | Description |
|---|---|
SESSION |
Specifies that the command takes effect for the current session. This is the default |
LOCAL |
Specifies that the command takes effect for only the current transaction. After |
configuration_parameter |
The name of a Greengage DB configuration parameter. Only parameters classified as session can be changed with |
value |
New value of parameter. Values can be specified as string constants, identifiers, numbers, or comma-separated lists of these. |
TIME ZONE |
See the Time Zones section of the PostgreSQL documentation for more information about time zones in Greengage DB |
Examples
Set the schema search path:
SET search_path TO my_schema, public;
Increase the segment host memory per query to 200 MB:
SET statement_mem TO '200MB';
Set the style of date to traditional PostgreSQL with "day before month" input convention:
SET datestyle TO postgres, dmy;
Set the time zone for San Mateo, California (Pacific Time):
SET TIME ZONE 'PST8PDT';
Set the time zone for Italy:
SET TIME ZONE 'Europe/Rome';
Compatibility
SET TIME ZONE extends syntax defined in the SQL standard. The standard allows only numeric time zone offsets while Greengage DB allows more flexible time-zone specifications. All other SET features are Greengage DB extensions.