Skip to content

Latest commit

 

History

History
128 lines (105 loc) · 7.39 KB

show-vars.md

File metadata and controls

128 lines (105 loc) · 7.39 KB
title summary toc redirect_from
SHOW (session settings)
The SHOW statement displays the current settings for the client session.
false
show-all.html
show-transaction.html
show-time-zone.html

The SHOW statement can display the value of either one or all of the session setting variables. Some of these can also be configured via SET.

Required Privileges

No privileges are required to display the session settings.

Synopsis

{% include sql/{{ page.version.version }}/diagrams/show_var.html %}

{{site.data.alerts.callout_info}}The SHOW statement for session settings is unrelated to the other SHOW statements: SHOW CLUSTER SETTING, SHOW CREATE TABLE, SHOW CREATE VIEW, SHOW USERS, SHOW DATABASES, SHOW COLUMNS, SHOW GRANTS, and SHOW CONSTRAINTS.{{site.data.alerts.end}}

Parameters

The SHOW <session variable> statement accepts a single parameter: the variable name.

The variable name is case insensitive. It may be enclosed in double quotes; this is useful if the variable name itself contains spaces.

Supported variables

Variable name Description Initial value Can be modified with SET?
application_name The current application name for statistics collection. Empty string, or cockroach for sessions from the built-in SQL client Yes
database The current database. Database in connection string, or empty if not specified Yes
default_transaction_isolation The default transaction isolation level for the current session. See Transaction parameters for more details. Settings in connection string, or SERIALIZABLE if not specified Yes
distsql auto
node_id New in v1.1: The ID of the node currently connected to.

This variable is particularly useful for verifying load balanced connections.
Node-dependent No
search_path Changed in v2.0: A list of schemas that will be searched to resolve unqualified table or function names. For more details, see Name Resolution. {public} Yes
server_version The version of PostgreSQL that CockroachDB emulates. Version-dependent No
server_version_num New in v2.0: The version of PostgreSQL that CockroachDB emulates. Version-dependent Yes
session_user The user connected for the current session. User in connection string No
sql_safe_updates If false, potentially unsafe SQL statements are allowed, including DROP of a non-empty database and all dependent objects, DELETE without a WHERE clause, UPDATE without a WHERE clause, and ALTER TABLE .. DROP COLUMN. See Allow Potentially Unsafe SQL Statements for more details. true for interactive sessions from the built-in SQL client,
false for sessions from other clients
Yes
time zone The default time zone for the current session.

New in v2.0: Alias: "timezone"
UTC Yes
tracing off
transaction isolation level The isolation level of the current transaction. See Transaction parameters for more details.

New in v2.0: Alias: transaction_isolation
SERIALIZABLE Yes
transaction priority The priority of the current transaction. See Transaction parameters for more details.

New in v2.0: Alias: transaction_priority
NORMAL Yes
transaction_read_only New in v2.0: (Reserved; exposed only for ORM compatibility.) off No
transaction status The state of the current transaction. See Transactions for more details.

New in v2.0: Alias: transaction_status
NoTxn No
client_encoding (Reserved; exposed only for ORM compatibility.) UTF8 No
client_min_messages (Reserved; exposed only for ORM compatibility.) (Reserved) No
datestyle (Reserved; exposed only for ORM compatibility.) ISO No
extra_float_digits (Reserved; exposed only for ORM compatibility.) (Reserved) No
max_index_keys (Reserved; exposed only for ORM compatibility.) (Reserved) No
standard_conforming_strings (Reserved; exposed only for ORM compatibility.) (Reserved) No

Special syntax cases supported for compatibility:

Syntax Equivalent to
SHOW TRANSACTION PRIORITY SHOW "transaction priority"
SHOW TRANSACTION ISOLATION LEVEL SHOW "transaction isolation level"
SHOW TIME ZONE SHOW "timezone"
SHOW TRANSACTION STATUS SHOW "transaction status"

Examples

Showing the Value of a Single Session Variable

> SHOW DATABASE;
+----------+
| database |
+----------+
| test     |
+----------+
(1 row)

Showing the Value of all Session Variables

> SHOW ALL;
+-------------------------------+--------------+
|           Variable            |    Value     |
+-------------------------------+--------------+
| application_name              |              |
| client_encoding               | UTF8         |
| client_min_messages           |              |
| database                      |              |
| default_transaction_isolation | SERIALIZABLE |
| distsql                       | off          |
| extra_float_digits            |              |
| max_index_keys                |           32 |
| node_id                       |            1 |
| search_path                   | pg_catalog   |
| server_version                | 9.5.0        |
| session_user                  | root         |
| standard_conforming_strings   | on           |
| timezone                      | UTC          |
| transaction isolation level   | SERIALIZABLE |
| transaction priority          | NORMAL       |
| transaction status            | NoTxn        |
+-------------------------------+--------------+
(16 rows)

See Also