Skip to main content

SET

Changes the value of a runtime Relyt configuration parameter.


Syntax

SET [ SESSION | LOCAL ] <config_param> { TO | = } { <value> | '<value>' | DEFAULT }

SET [SESSION | LOCAL] TIME ZONE { <value> | '<value>' | LOCAL | DEFAULT }

Description

You can use SET to change the values for a configuration parameter. The new value works only for the current session.

Suppose a transaction that includes SET or SET SESSION is running. If the transaction is rolled back after SET or SET SESSION is run, the new configuration parameter setting specified by the SET or SET SESSION is also rolled back. If the transaction is committed, the new configuration parameter setting is effective until the session ends, unless being overridden by another SET.


Parameters

  • SESSION or LOCAL

    The effective scope of the new setting. Possible options include:

    • SESSION: specifies that the change is effective only for the current session and is the default.
    • LOCAL: specifies that the change is effective only for the current transaction.
  • <config_param>

    The name of the configuration parameter.

  • <value> or DEFAULT

    The new value of the parameter. The data type of the value is determined by the configuration parameter and can be string constant, identifier, number, or comma-separated list of them. You can use DEFAULT to set the configuration parameter to its default. If the value indicates the memory size or time, use a pair of single quotes (' ') to enclose the value.

  • SCHEMA

    SET SCHEMA 'value' can be used to replace SET search_path TO <value> to change the search path for a schema. Only one schema can be specified using the syntax.

  • NAMES

    SET NAMES <value> can be used to replace SET client_encoding TO <value> to change the character encoding.

  • SEED

    Use SEED to set the internal seed for the random number generator (the function random()). Possible values are floating-point numbers that range from -1 to 1.

    Relyt also allows you to invoke function setseed() to reset the seed. Following shows the syntax:

    SELECT setseed(value);
  • TIME ZONE

    SET TIME ZONE <value> can be used to replace SET timezone TO <value> to reset the time zone. Following are value examples of value:

    • 'Europe/Rome'
    • -7 (time zone 7 hours west from UTC)
    • INTERVAL '-08:00' HOUR TO MINUTE (time zone 8 hours west from UTC)
  • LOCAL or DEFAULT

    Specifies to use local time zone or the default time zone.


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 POSTGRES with "day before month" input convention:

SET datestyle TO postgres, dmy;

Set the time zone for Italy:

SET TIME ZONE 'Europe/Rome'; 

SQL standard compatibility

All SET features are Relyt extensions, except SET TIME ZONE.

SET TIME ZONE in Relyt is fully compatible with SET TIME ZONE in the SQL standard and extends its support for more flexible time-zone specifications, while SET TIME ZONE in the SQL standard supports only numeric time zone offsets.