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.
This is the multi-page printable view of this section. Click here to print.
System information functions
- 1: CURRENT_DATABASE
- 2: CURRENT_USER
- 3: DBNAME (function)
- 4: HAS_TABLE_PRIVILEGE
- 5: LIST_ENABLED_CIPHERS
- 6: SESSION_USER
- 7: USER
- 8: USERNAME
- 9: VERSION
1 - CURRENT_DATABASE
Returns the name of the current database, equivalent to
DBNAME
.
Behavior type
StableSyntax
Note
Parentheses are optional.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.
Behavior type
StableSyntax
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
.
Behavior type
ImmutableSyntax
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.
This is a meta-function. You must call meta-functions in a top-level SELECT statement.
Behavior type
VolatileBehavior type
StableSyntax
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:
-
SELECT: Query tables. SELECT privileges are granted by default to the PUBLIC role.
-
INSERT: Insert table rows with INSERT, and load data with
COPY
.Note
COPY FROM STDIN
is allowed for users with INSERT privileges, whileCOPY FROM
file
requires admin privileges. -
UPDATE: Update table rows.
-
DELETE: Delete table rows.
-
REFERENCES: Create foreign key constraints on this table. This privilege must be set on both referencing and referenced tables.
-
TRUNCATE: Truncate table contents. Non-owners of tables can also execute the following partition operations on them:
-
ALTER: Modify a table's DDL with
ALTER TABLE
. -
DROP: Drop a table.
-
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.
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.
Behavior type
StableSyntax
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.
Behavior type
StableSyntax
USER()
Notes
-
The USER function does not require parentheses.
-
USER is equivalent to CURRENT_USER, SESSION_USER, and USERNAME.
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.
Behavior type
StableSyntax
USERNAME()
Notes
-
This function is useful for permission checking.
-
USERNAME is equivalent to CURRENT_USER, SESSION_USER and USER.
Examples
=> SELECT USERNAME();
username
--------------
dbadmin
(1 row)
9 - VERSION
Returns a VARCHAR containing a Vertica node's version information.
Behavior type
StableSyntax
VERSION()
Note
The parentheses are required.Examples
=> SELECT VERSION();
VERSION
-------------------------------------------
Vertica Analytic Database v10.0.0-0
(1 row)