This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

System information functions

These functions provide system information regarding user sessions.

These functions provide system information regarding user sessions. A superuser has unrestricted access to all system information, but users can view only information about their own, current sessions.

1 - CURRENT_DATABASE

Returns the name of the current database, equivalent to DBNAME.

Returns the name of the current database, equivalent to DBNAME.

Behavior type

Stable

Syntax

CURRENT_DATABASE()

Examples

=> SELECT CURRENT_DATABASE;
 CURRENT_DATABASE
------------------
 VMart
(1 row)

2 - CURRENT_USER

Returns a VARCHAR containing the name of the user who initiated the current database connection.

Returns a VARCHAR containing the name of the user who initiated the current database connection.

Behavior type

Stable

Syntax

CURRENT_USER()

Notes

  • The CURRENT_USER function does not require parentheses.

  • This function is useful for permission checking.

  • CURRENT_USER is equivalent to SESSION_USER, USER, and USERNAME.

Examples

=> SELECT CURRENT_USER();
 CURRENT_USER
--------------
 dbadmin
(1 row)

The following command returns the same results without the parentheses:

=> SELECT CURRENT_USER;
 CURRENT_USER
--------------
 dbadmin
(1 row)

3 - DBNAME (function)

Returns the name of the current database, equivalent to CURRENT_DATABASE.

Returns the name of the current database, equivalent to CURRENT_DATABASE.

Behavior type

Immutable

Syntax

DBNAME()

Examples

=> SELECT DBNAME();
      dbname
------------------
 VMart
(1 row)

4 - HAS_TABLE_PRIVILEGE

Returns true or false to verify whether a user has the specified privilege on a table.

Returns true or false to verify whether a user has the specified privilege on a table.

This is a meta-function. You must call meta-functions in a top-level SELECT statement.

Behavior type

Volatile

Behavior type

Stable

Syntax

HAS_TABLE_PRIVILEGE ( [ user, ] '[[database.]schema.]table', 'privilege' )

Parameters

user
Name or OID of a database user. If omitted, Vertica checks privileges for the current user.
[database.]schema

Database and schema. The default schema is public. If you specify a database, it must be the current database.

table
Name or OID of the table to check.
privilege
A table privilege, one of the following:

Privileges

Non-superuser, one of the following:

  • Table owner

  • USAGE privilege on the table schema and one or more privileges on the table

Examples

=> SELECT HAS_TABLE_PRIVILEGE('store.store_dimension', 'SELECT');
 HAS_TABLE_PRIVILEGE
---------------------
 t
(1 row)

=> SELECT HAS_TABLE_PRIVILEGE('release', 'store.store_dimension', 'INSERT');
 HAS_TABLE_PRIVILEGE
---------------------
 t
(1 row)

=> SELECT HAS_TABLE_PRIVILEGE(45035996273711159, 45035996273711160, 'select');
 HAS_TABLE_PRIVILEGE
---------------------
t
(1 row)

5 - LIST_ENABLED_CIPHERS

Returns a list of enabled cipher suites, which are sets of algorithms used to secure TLS/SSL connections.

Returns a list of enabled cipher suites, which are sets of algorithms used to secure TLS/SSL connections.

By default, Vertica uses OpenSSL's default cipher suites. For more information, see the OpenSSL man page.

Syntax

LIST_ENABLED_CIPHERS()

Examples

=> SELECT LIST_ENABLED_CIPHERS();
SSL_RSA_WITH_RC4_128_MD5
SSL_RSA_WITH_RC4_128_SHA
TLS_RSA_WITH_AES_128_CBC_SHA

See also

6 - SESSION_USER

Returns a VARCHAR containing the name of the user who initiated the current database session.

Returns a VARCHAR containing the name of the user who initiated the current database session.

Behavior type

Stable

Syntax

SESSION_USER()

Notes

  • The SESSION_USER function does not require parentheses.

  • SESSION_USER is equivalent to CURRENT_USER, USER, and USERNAME.

Examples

=> SELECT SESSION_USER();
 session_user
--------------
 dbadmin
(1 row)

The following command returns the same results without the parentheses:

=> SELECT SESSION_USER;
 session_user
--------------
 dbadmin
(1 row)

7 - USER

Returns a VARCHAR containing the name of the user who initiated the current database connection.

Returns a VARCHAR containing the name of the user who initiated the current database connection.

Behavior type

Stable

Syntax

USER()

Notes

Examples

=> SELECT USER();
 current_user
--------------
 dbadmin
(1 row)

The following command returns the same results without the parentheses:

=> SELECT USER;
 current_user
--------------
 dbadmin
(1 row)

8 - USERNAME

Returns a VARCHAR containing the name of the user who initiated the current database connection.

Returns a VARCHAR containing the name of the user who initiated the current database connection.

Behavior type

Stable

Syntax

USERNAME()

Notes

Examples

=> SELECT USERNAME();
 username
--------------
 dbadmin
(1 row)

9 - VERSION

Returns a VARCHAR containing a Vertica node's version information.

Returns a VARCHAR containing a Vertica node's version information.

Behavior type

Stable

Syntax

VERSION()

Examples

=> SELECT VERSION();
                    VERSION
-------------------------------------------
Vertica Analytic Database v10.0.0-0
(1 row)