All Products
Search
Document Center

Lindorm:Session variables

Last Updated:Mar 28, 2026

Session variables let you control SQL engine behavior on a per-connection basis. Changes take effect immediately for the current session and do not affect other sessions.

Prerequisites

Before you begin, ensure that you have:

  • Lindorm SQL version 2.8.4.0 or later. To check your version, see SQL versions.

Applicable engines

LindormTable and LindormTSDB (all versions).

Syntax

Set a session variable:

SET [SESSION] variable_identifier = literal

Query a session variable:

SELECT @@variable_identifier

Variable names follow the same lexical rules as common identifiers. For details, see Lexical structure of Lindorm SQL.

Session variables reference

Session-level parameters set by SET take precedence over global parameters set by ALTER SYSTEM. When the two conflict, the session-level value always wins.

Important

Modifying session-level parameters affects SQL engine behavior for the duration of the session. Understand each parameter before changing it.

TIME_ZONE

AttributeValue
Data typeString
Default+08:00 (UTC+8)
Applicable engineLindormTable
Protocol constraintMySQL protocol only

Sets the time zone for the current session. Only available when connecting via the MySQL protocol.

SQL_MODE

AttributeValue
Data typeString
Applicable engineLindormTable, LindormTSDB
Introduced inLindorm SQL 2.8.4.8

Controls the SQL engine parsing behavior. To set multiple modes, separate them with a comma (,).

Only supported value:

  • NO_BACKSLASH_ESCAPES — Backslashes (\) are treated as literal characters rather than escape characters when parsing string literals.

Examples

Change the session time zone

  1. Query the current session time zone:

    SELECT @@TIME_ZONE;

    Expected output:

    +-------------+
    | @@TIME_ZONE |
    +-------------+
    | +08:00      |
    +-------------+
  2. Change the time zone to UTC:

    SET TIME_ZONE='UTC';
  3. Verify the change:

    SELECT @@TIME_ZONE;

    Expected output:

    +-------------+
    | @@TIME_ZONE |
    +-------------+
    | UTC         |
    +-------------+
Note

For details on how the session time zone affects timestamp data, see Specify a time zone for a LindormTable connection.

Disable backslash escaping

  1. Query a string literal to observe the default escape behavior:

    SELECT '{\"key\":\"va\\lu\'e\r\n\"}';

    Expected output:

    +---------------------+
    | EXPR$0              |
    +---------------------+
    | {"key":"va\lu'e
    "} |
    +---------------------+
  2. Set NO_BACKSLASH_ESCAPES to disable backslash escaping:

    SET SQL_MODE='NO_BACKSLASH_ESCAPES';
  3. Run the same query to verify the change:

    SELECT '{\"key\":\"va\\lu\'e\r\n\"}';

    Expected output:

    +-----------------------------+
    | EXPR$0                      |
    +-----------------------------+
    | {\"key\":\"va\\lu\'e\r\n\"} |
    +-----------------------------+

    With NO_BACKSLASH_ESCAPES active, backslashes are no longer treated as escape characters, so the string is returned as-is.