Skip to content

Information Functions

The following information related functions are available in Okera.

Function Description
connected_user() Returns the name of the connected user
current_database() Returns the name of the currently selected database
effective_user() Returns the name of the effective user
max_bigint() Returns the maximum value for BIGINT values
max_int() Returns the maximum value for INT values
max_smallint() Returns the maximum value for SMALLINT values
max_tinyint() Returns the maximum value for TINYINT values
min_bigint() Returns the minimum value for BIGINT values
min_int() Returns the minimum value for INT values
min_smallint() Returns the minimum value for SMALLINT values
min_tinyint() Returns the minimum value for TINYINT values
pid() Returns the process ID of the server processing the request
user() Same as effective_user() function
uuid() Returns random UUIDs
version() Returns the Okera version in use

The following explains some of the functions and statements in more detail.

  • STRING connected_user, effective_user(), and user()

    Returns the information about the user connected to the Okera cluster. Typically the connected_user() function is returning the user or principal used internally between the cluster services. Usually user() and effective_user() are the same, since Okera is not supporting user impersonation.

    Example: Using the various user() functions

    > SELECT connected_user() AS conn_user,
        effective_user() AS eff_user,
        user() AS user;
    

    conn_user eff_user user --------- -------- ---- okera joebloggs joebloggs

    Note: When the cluster is kerberized, the connected user will contain the full Kerberos principal used internally, for instance okera/service@SAMPLECORP.TEST

  • STRING current_database()

    Returns the name of the database set for the session.

    Example: Using the current_database() function

    > USE okera_sample;
    Ok
    > SELECT current_database();
    okera_sample
    
  • STRING uuid()

    Returns random UUIDs.

    Example: Using the uuid() function

    > SELECT uuid(), uuid()
    aec3ac42-1327-410b-bea3-2e8d4fcc850e
    f25ed23b-a542-442b-8335-712acf6f3093
    
  • STRING version()

    Returns the version of the server. Useful to verify that the cluster version matches what is expected.

    Example: Using the version() function

    > SELECT version()
    recordserviced version 1.5.1 RELEASE (build da0d7546090423b2bf80119fef21c4454b31978b)
    Built on Wed, 18 Sep 2019 01:55:44 PST