background image
<< SYSCS_DIAG diagnostic tables and functions | SYSCS_DIAG.ERROR_MESSAGES diagnostic table >>

SYSCS_DIAG.CONTAINED_ROLES diagnostic table function

<< SYSCS_DIAG diagnostic tables and functions | SYSCS_DIAG.ERROR_MESSAGES diagnostic table >>
Derby Reference Manual
182
Diagnostic Table Expression
Type of Expression
SYSCS_DIAG.CONTAINED_ROLES
Table function
SYSCS_DIAG.ERROR_LOG_READER
Table function
SYSCS_DIAG.ERROR_MESSAGES
Table
SYSCS_DIAG.LOCK_TABLE
Table
SYSCS_DIAG.SPACE_TABLE
Table function
SYSCS_DIAG.STATEMENT_CACHE
Table
SYSCS_DIAG.STATEMENT_DURATION
Table function
SYSCS_DIAG.TRANSACTION_TABLE
Table
Restriction: If you reference a diagnostic table in a DDL statement or a compression
procedure, Derby returns an exception.
SYSCS_DIAG.CONTAINED_ROLES diagnostic table function
The SYSCS_DIAG.CONTAINED_ROLES diagnostic table function returns all the roles
contained within the specified role. The argument that is passed to this table function
should be the name of the role, specified as a string in quotes, or the special keyword
CURRENT_ROLE, which indicates the current role in effect. For a definition of role
containment, see "Syntax for roles" in
GRANT statement
.
For example:
SELECT * FROM TABLE (SYSCS_DIAG.CONTAINED_ROLES('READER')) AS T1
SELECT * FROM TABLE (SYSCS_DIAG.CONTAINED_ROLES(CURRENT_ROLE)) AS T2
All users can access this diagnostic table function, whether or not the database has
authentication and SQL authorization enabled.
SYSCS_DIAG.ERROR_LOG_READER diagnostic table function
The SYSCS_DIAG.ERROR_LOG_READER diagnostic table function contains all the
useful SQL statements that are in the
derby.log
file or a log file that you specify.
One use of this diagnostic table function is to determine the active transactions and the
SQL statements in those transactions at a given point in time. For example, if a deadlock
or lock timeout occurred you can find the timestamp (timestampConstant) in the error log.
For a database for which authentication and SQL authorization are both enabled, only the
database owner
can access this diagnostic table function.
To access the SYSCS_DIAG.ERROR_LOG_READER diagnostic table function, you
must use the SQL table function syntax.
For example:
SELECT *
FROM TABLE (SYSCS_DIAG.ERROR_LOG_READER())
AS T1
where T1 is a user-specified table name that is any valid identifier.
You can specify a log file name as an optional argument to the
SYSCS_DIAG.ERROR_LOG_READER diagnostic table function. When you specify a log
file name, the file name must be an expression whose data type maps to a Java string.
For example:
SELECT *