SET

Change the value of the YMatrix database configuration parameters.

Summary

SET [SESSION | LOCAL] configuration_parameter {TO | =} value | 'value' | DEFAULT}
SET [SESSION | LOCAL] TIME ZONE {timezone | LOCAL | DEFAULT}

describe

The SET command changes the server configuration parameters. Any configuration parameters classified as session parameters can be changed instantly using SET. SET only affects the values ​​used by the current session.

If SET or SET SESSION is issued in a transaction that is aborted later, the effect of the SET command disappears when the transaction is rolled back. Once a transaction is committed, the effect will continue until the end of the session unless it is overwritten by another SET.

The impact of SET LOCAL only lasts until the end of the current transaction, whether committed or not. A special case is that SET LOCAL is followed by SET in a single transaction: The SET LOCAL value will be displayed until the end of the transaction, but then (if a transaction is committed) the SET value will take effect.

If SET LOCAL is used in a function that contains SET options for the same configuration parameter (see CREATE FUNCTION), the effect of the SET LOCAL command disappears when the function exits; anyway, the value that was valid when the function was called is restored. This allows SET LOCAL to be used for dynamic or repeated changes to parameters in a function, while preserving the convenience of saving and restoring caller values ​​using SET options. Note that regular SET commands override SET options for surrounding functions. Unless it rolls back, its impact persists.

If you use the DECLARE command to create a cursor in a transaction, you can only use the SET command in a transaction after closing the cursor with the CLOSE command.

Parameters

SESSION

  • Specify that this command takes effect on the current session. This is the default value.

LOCAL

  • Specifies that this command is only effective for the current transaction. After COMMIT or ROLLBACK, the session-level settings will take effect again. Note that if SET LOCAL is executed outside the transaction, it seems to be invalid.

configuration_parameter

  • The name of the YMatrix database configuration parameter. Using SET can only change parameters classified as session.

value

  • New value of the parameter. Values ​​can be specified as string constants, identifiers, numbers, or comma-separated lists. DEFAULT can be used to specify that the parameter is reset to its default value. If you specify a memory size or unit of time, the value is enclosed in single quotes.

TIME ZONE

  • SET TIME ZONE value is SET timezone TO value. Syntax SET TIME ZONE allows time zone specification to use special syntax. Here is an example of valid values:
    • 'PST8PDT'
    • 'Europe/Rome'
    • -7 (7-hour time zone west of UTC)
    • INTERVAL '-08:00' HOUR TO MINUTE (8-hour time zone west of UTC).

LOCAL

DEFAULT

  • Set the time zone to your local time zone (i.e. the server's default timezone).

Example

Set the schema search path:

SET search_path TO my_schema, public;

Increase the segment host memory for each query to 200 MB:

SET statement_mem TO '200MB';

Set date style to the input habit of "Day before the month" of traditional POSTGRES:

SET datestyle TO postgres, dmy;

Set the time zone (Pacific time) of San Mateo, California:

SET TIME ZONE 'PST8PDT';

Set the time zone of Italy:

SET TIME ZONE 'Europe/Rome'; 

Sets the system default SEGMENT_SET object.

SET mx_default_segment_set TO 'ss1';

compatibility

SET TIME ZONE extends the syntax defined in the SQL standard. This standard allows only digital time zone offsets, while the YMatrix database allows for more flexible time zone specifications. All other features of SET are YMatrix database extensions.

See also

RESET, SHOW, CREATE SEGMENT SET