@SystemCatalog — Returns metadata about the database schema.
@SystemCatalog String component
The @SystemCatalog system procedure returns information about the schema of the VoltDB database, depending upon the component keyword you specify. The following are the allowable values of component:
Returns a list of columns for all of the tables in the database.
Returns information about user-defined functions in the database.
Returns information about the indexes in the database schema. Note that the procedure returns information for each column in the index. In other words, if an index is composed of three columns, the result set will include three separate entries for the index, one for each column.
Returns information about the primary keys in the database schema. Note that the procedure returns information for each column in the primary key. If an primary key is composed of three columns, the result set will include three separate entries.
Returns information about the arguments to the stored procedures.
Returns information about the stored procedures defined in the database.
Returns information about the roles defined in the database and their associated permissions.
Returns information about the tables in the database.
Returns information about the tasks defined in the database.
Returns information about the users defined in the database and their associated roles.
Returns a different VoltTable for each component. The layout of the VoltTables is designed to match the corresponding JDBC data structures. Columns are provided for all JDBC properties, but where VoltDB has no corresponding element the column is unused and a null value is returned.
For the COLUMNS component, the VoltTable has the following columns:
Name | Datatype | Description |
---|---|---|
TABLE_CAT | STRING | Unused. |
TABLE_SCHEM | STRING | Unused. |
TABLE_NAME | STRING | The name of the database table the column belongs to. |
COLUMN_NAME | STRING | The name of the column. |
DATA_TYPE | INTEGER | An enumerated value specifying the corresponding Java SQL datatype of the column. |
TYPE_NAME | STRING | A string value specifying the datatype of the column. |
COLUMN_SIZE | INTEGER | The length of the column in bits, characters, or digits, depending on the datatype. |
BUFFER_LENGTH | INTEGER | Unused. |
DECIMAL_DIGITS | INTEGER | The number of fractional digits in a DECIMAL datatype column. (Null for all other datatypes.) |
NUM_PREC_RADIX | INTEGER | Specifies the radix, or numeric base, for calculating the column size. A radix of 2 indicates the column size is measured in bits while a radix of 10 indicates a measurement in bytes or digits. |
NULLABLE | INTEGER | Indicates whether the column value can be null (1) or not (0). |
REMARKS | STRING | Contains the string "PARTITION_COLUMN" if the column is the partitioning key for a partitioned table. Otherwise null. |
COLUMN_DEF | STRING | The default value for the column. |
SQL_DATA_TYPE | INTEGER | Unused. |
SQL_DATETIME_SUB | INTEGER | Unused. |
CHAR_OCTET_LENGTH | INTEGER | For variable length columns (VARCHAR and VARBINARY), the maximum length of the column. Null for all other datatypes. |
ORDINAL_POSITION | INTEGER | An index specifying the position of the column in the list of columns for the table, starting at 1. |
IS_NULLABLE | STRING | Specifies whether the column can contain a null value ("YES") or not ("NO"). |
SCOPE_CATALOG | STRING | Unused. |
SCOPE_SCHEMA | STRING | Unused. |
SCOPE_TABLE | STRING | Unused. |
SOURCE_DATE_TYPE | SMALLINT | Unused. |
IS_AUTOINCREMENT | STRING | Specifies whether the column is auto-incrementing or not. (Always returns "NO"). |
For the FUNCTIONS component, the VoltTable has the following columns:
Name | Datatype | Description |
---|---|---|
FUNCTION_TYPE | STRING | The function type is always "scalar". |
FUNCTION_NAME | STRING | The name of the user-defined function. |
CLASS_NAME | STRING | The Java class name that contains the user-defined function method. |
METHOD_NAME | STRING | The name of the method that implements the user-defined function. |
For the INDEXINFO component, the VoltTable has the following columns:
Name | Datatype | Description |
---|---|---|
TABLE_CAT | STRING | Unused. |
TABLE_SCHEM | STRING | Unused. |
TABLE_NAME | STRING | The name of the database table the index applies to. |
NON_UNIQUE | TINYINT | Value specifying whether the index is unique (0) or not (1). |
INDEX_QUALIFIER | STRING | Unused. |
INDEX_NAME | STRING | The name of the index that includes the current column. |
TYPE | SMALLINT | A value indicating the type of index, which is always three (3). |
ORDINAL_POSITION | SMALLINT | An index specifying the position of the column in the index, starting at 1. |
COLUMN_NAME | STRING | The name of the column. |
ASC_OR_DESC | STRING | A string value specifying the sort order of the index. Possible values are "A" for ascending or null for unsorted indexes. |
CARDINALITY | INTEGER | Unused. |
PAGES | INTEGER | Unused. |
FILTER_CONDITION | STRING | Unused. |
For the PRIMARYKEYS component, the VoltTable has the following columns:
Name | Datatype | Description |
---|---|---|
TABLE_CAT | STRING | Unused. |
TABLE_SCHEM | STRING | Unused. |
TABLE_NAME | STRING | The name of the database table. |
COLUMN_NAME | STRING | The name of the column in the primary key. |
KEY_SEQ | SMALLINT | An index specifying the position of the column in the primary key, starting at 1. |
PK_NAME | STRING | The name of the primary key. |
For the PROCEDURECOLUMNS component, the VoltTable has the following columns:
Name | Datatype | Description |
---|---|---|
PROCEDURE_CAT | STRING | Unused. |
PROCEDURE_SCHEM | STRING | Unused. |
PROCEDURE_NAME | STRING | The name of the stored procedure. |
COLUMN_NAME | STRING | The name of the procedure parameter. |
COLUMN_TYPE | SMALLINT | An enumerated value specifying the parameter type. Always returns 1, corresponding to procedureColumnIn. |
DATA_TYPE | INTEGER | An enumerated value specifying the corresponding Java SQL datatype of the column. |
TYPE_NAME | STRING | A string value specifying the datatype of the parameter. |
PRECISION | INTEGER | The length of the parameter in bits, characters, or digits, depending on the datatype. |
LENGTH | INTEGER | The length of the parameter in bytes. For variable length datatypes (VARCHAR and VARBINARY), this value specifies the maximum possible length. |
SCALE | SMALLINT | The number of fractional digits in a DECIMAL datatype parameter. (Null for all other datatypes.) |
RADIX | SMALLINT | Specifies the radix, or numeric base, for calculating the precision. A radix of 2 indicates the precision is measured in bits while a radix of 10 indicates a measurement in bytes or digits. |
NULLABLE | SMALLINT | Unused. |
REMARKS | STRING | If this column contains the string "PARTITION_PARAMETER", the parameter is the partitioning key for a single-partitioned procedure. If the column contains the string "ARRAY_PARAMETER" the parameter is a native Java array. Otherwise this column is null. |
COLUMN_DEF | STRING | Unused. |
SQL_DATA_TYPE | INTEGER | Unused. |
SQL_DATETIME_SUB | INTEGER | Unused. |
CHAR_OCTET_LENGTH | INTEGER | For variable length columns (VARCHAR and VARBINARY), the maximum length of the column. Null for all other datatypes. |
ORDINAL_POSITION | INTEGER | An index specifying the position in the parameter list for the procedure, starting at 1. |
IS_NULLABLE | STRING | Unused. |
SPECIFIC_NAME | STRING | Same as COLUMN_NAME |
For the PROCEDURES component, the VoltTable has the following columns:
Name | Datatype | Description |
---|---|---|
PROCEDURE_CAT | STRING | Unused. |
PROCEDURE_SCHEM | STRING | Unused. |
PROCEDURE_NAME | STRING | The name of the stored procedure. |
RESERVED1 | STRING | Unused. |
RESERVED2 | STRING | Unused. |
RESERVED3 | STRING | Unused. |
REMARKS | STRING | Unused. |
PROCEDURE_TYPE | SMALLINT | An enumerated value that specifies the type of procedure. Always returns zero (0), indicating "unknown". |
SPECIFIC_NAME | STRING | Same as PROCEDURE_NAME. |
For the ROLES component, the VoltTable has the following columns:
Name | Datatype | Description |
---|---|---|
ROLE | STRING | The name of the role. |
PERMISSIONS | STRING | A comma-separated list of permissions associated with the role. |
For the TABLES component, the VoltTable has the following columns:
Name | Datatype | Description |
---|---|---|
TABLE_CAT | STRING | Unused. |
TABLE_SCHEM | STRING | Unused. |
TABLE_NAME | STRING | The name of the database table. |
TABLE_TYPE | STRING | Specifies whether the table is a data table ("TABLE"), a materialized view ("VIEW"), or a stream ('EXPORT"). |
REMARKS | STRING | Unused. |
TYPE_CAT | STRING | Unused. |
TYPE_SCHEM | STRING | Unused. |
TYPE_NAME | STRING | Unused. |
SELF_REFERENCING_COL_NAME | STRING | Unused. |
REF_GENERATION | STRING | Unused. |
For the TASKS component, the VoltTable has the following columns:
Name | Datatype | Description |
---|---|---|
TASK_NAME | STRING | The name of the task. |
SCHEDULER_CLASS | STRING | The class name of the scheduler. |
SCHEDULER_PARAMETERS | STRING | The parameters to the scheduler. |
ACTIONS_CLASS | STRING | The class name of the task itself. |
ACTIONS_PARAMETERS | STRING | The parameters to the task procedure. |
SCHEDULE_CLASS | STRING | The class name of the schedule procedure. |
SCHEDULE_PARAMETERS | STRING | The parameters to the schedule procedure |
ON_ERROR | STRING | Specifies the ON ERROR condition ("LOG", "IGNORE", or 'STOP"). |
RUN_LOCATION | STRING | Specifies where the task runs ("DATABASE", "HOSTS", or "PARTITIONS"). |
USER | STRING | Identifies the username of the account under which the procedures runs. |
ENABLED | STRING | Specifies whether the task is currently enabled or disabled. |
For the USERS component, the VoltTable has the following columns:
Name | Datatype | Description |
---|---|---|
USER | STRING | The name of the user. |
ROLES | STRING | A comma-separated list of roles assigned to the user. |
The following example calls @SystemCatalog to list the stored procedures in the active database schema:
$ sqlcmd 1> exec @SystemCatalog procedures;
The next program example uses @SystemCatalog to display information about the tables in the database schema.
VoltTable[] results = null; try { results = client.callProcedure("@SystemCatalog", "TABLES").getResults(); System.out.println("Information about the database schema:"); for (VoltTable node : results) System.out.println(node.toString()); } catch (Exception e) { e.printStackTrace(); }