SHOW

A utility command for displaying the current value of a configuration parameter

SHOW is a utility command for displaying the current value of a configuration parameter.

SHOW was added in PostgreSQL 6.1.

Usage

SHOW is a simple and intuitive way of displaying the current value of a configuration parameter, or of listing the current value of all configuration parameters via the SHOW ALL syntax.

For historical reasons SHOW can also display the current setting for the following items:

  • IS_SUPERUSER
  • LC_COLLATE
  • LC_TYPE
  • SERVER_ENCODING
  • SERVER_VERSION

Alternatives to the SHOW command

The rows returned by SHOW cannot be manipulated at the SQL level, which limits the usefulness of this command to ad-hoc command-line queries.

The function current_setting() and the view pg_settings provide a more flexible way of obtaining information about current configuration parameter settings.

Source code

The code implementing SHOW is contained in src/backend/utils/misc/guc.c, specifically functions:

  • ShowGUCConfigOption() for SHOW name
  • ShowAllGUCConfig() for SHOW ALL

Change history

Examples

Display a normal configuration parameter:

postgres=# SHOW port;
 port 
------
 5432
(1 row)

Attempt to display a non-existent configuration parameter:

postgres=# SHOW foo;
ERROR:  unrecognized configuration parameter "foo"

Show all configuration parameters (output truncated for clarity):

postgres=# SHOW ALL;
-[ RECORD 1 ]-----------------------------------------------------------------------
name        | allow_system_table_mods
setting     | off
description | Allows modifications of the structure of system tables.
-[ RECORD 2 ]-----------------------------------------------------------------------
name        | application_name
setting     | psql
description | Sets the application name to be reported in statistics and logs.
-[ RECORD 3 ]-----------------------------------------------------------------------
name        | archive_cleanup_command
setting     |
description | Sets the shell command that will be executed at every restart point.
-[ RECORD 4 ]-----------------------------------------------------------------------
...
  • PostgreSQL documentation: SHOW

Categories

Configuration, SQL command, Utility command

See also

current_setting(), SET, RESET