Skip to content

System catalog views

View as Markdown

The system catalog views present the system catalog classes in readable form: names instead of object references, 'YES'/'NO' instead of flags, type names instead of codes. Every user can query them.

Each view shows only what the current user may see. DBA sees everything; other users see the tables they own, tables owned by groups they belong to, and tables on which they have SELECT permission. Names of tables, columns, indexes and triggers are stored in lowercase, user names in uppercase (see Querying the catalog).

Tables, views and system classes.

Column Type Description
class_name VARCHAR(255) Table name.
owner_name VARCHAR(255) Owner.
class_type VARCHAR(6) 'CLASS' table, 'VCLASS' view, 'VERTEX' vertex table, 'EDGE' edge table, 'TOPO' graph topology.
is_system_class VARCHAR(3) 'YES' for a system class, 'NO' otherwise.
tde_algorithm VARCHAR(32) Encryption algorithm: 'NONE', 'AES' or 'ARIA'.
partitioned VARCHAR(3) 'YES' for a partitioned table, 'NO' otherwise (also for the partitions themselves).
is_reuse_oid_class VARCHAR(3) 'YES' for a table created with REUSE_OID, 'NO' otherwise.
collation VARCHAR(32) Default collation of the table.
comment VARCHAR(2048) Table comment.

The user tables of the e-commerce database by type:

SELECT class_type, COUNT(*) AS tables
FROM db_class
WHERE is_system_class = 'NO'
GROUP BY class_type
ORDER BY class_type;
class_type tables
CLASS 3
EDGE 9
VERTEX 6

The relational and vertex tables:

SELECT class_name, class_type, collation
FROM db_class
WHERE is_system_class = 'NO' AND class_type IN ('CLASS', 'VERTEX')
ORDER BY class_type, class_name;
class_name class_type collation
countries CLASS utf8_bin
order_items CLASS utf8_bin
orders CLASS utf8_bin
brand VERTEX utf8_bin
category VERTEX utf8_bin
city VERTEX utf8_bin
customer VERTEX utf8_bin
product VERTEX utf8_bin
supplier VERTEX utf8_bin

The direct superclasses of tables created with UNDER (see Class inheritance).

Column Type Description
class_name VARCHAR(255) Table name.
super_class_name VARCHAR(255) Name of a direct superclass.
CREATE TABLE b2b_order UNDER orders (po_number VARCHAR(20));
SELECT class_name, super_class_name FROM db_direct_super_class WHERE class_name = 'b2b_order';
class_name super_class_name
b2b_order orders

The queries of views.

Column Type Description
vclass_name VARCHAR(255) View name.
vclass_def VARCHAR(1073741823) The view's query, as stored by CoraDB.
comment VARCHAR(2048) View comment.
CREATE VIEW order_totals AS SELECT order_id, SUM(quantity) AS items FROM order_items GROUP BY order_id;
SELECT vclass_def FROM db_vclass WHERE vclass_name = 'order_totals';
vclass_def
select [order_items].[order_id], sum([order_items].[quantity]) from [order_items] [order_items] group by [order_items].[order_id]

The system catalog views are listed here too; SELECT vclass_def FROM db_vclass WHERE vclass_name = 'db_charset' shows how db_charset is built from _db_charset and _db_collation.

Columns.

Column Type Description
attr_name VARCHAR(255) Column name.
class_name VARCHAR(255) Table name.
attr_type VARCHAR(8) 'INSTANCE' column, 'CLASS' class attribute, 'SHARED' shared attribute.
def_order INTEGER Position of the column in the table, from 0. An inherited column keeps its position in the superclass.
from_class_name VARCHAR(255) For an inherited column, the superclass that defines it; otherwise NULL.
from_attr_name VARCHAR(255) For an inherited column renamed to resolve a name conflict, its name in the superclass; otherwise NULL.
data_type VARCHAR(9) Data type name, as in Data type codes. VARCHAR columns show as STRING, LIST columns as SEQUENCE.
prec INTEGER Precision, or 0 if none.
scale INTEGER Scale, or 0 if none.
charset VARCHAR(32) Charset of a character column.
collation VARCHAR(32) Collation of a character column.
domain_class_name VARCHAR(255) For an object type, the referenced table; otherwise NULL.
default_value VARCHAR(255) Default value as a string, or NULL if there is none.
is_nullable VARCHAR(3) 'NO' if the column has a NOT NULL constraint, 'YES' otherwise.
comment VARCHAR(1024) Column comment.

The columns of orders:

SELECT attr_name, data_type, prec, scale, is_nullable
FROM db_attribute
WHERE class_name = 'orders'
ORDER BY def_order;
attr_name data_type prec scale is_nullable
id INTEGER 10 0 NO
customer_id INTEGER 10 0 NO
shipped_date DATE 10 0 YES
shipping_cost NUMERIC 10 2 NO
ship_address STRING 128 0 NO
order_date DATE 10 0 NO

In a subclass, from_class_name shows where each inherited column comes from:

CREATE TABLE b2b_order UNDER orders (po_number VARCHAR(20));
SELECT attr_name, from_class_name FROM db_attribute WHERE class_name = 'b2b_order' ORDER BY def_order;
attr_name from_class_name
id orders
customer_id orders
shipped_date orders
shipping_cost orders
ship_address orders
order_date orders
po_number NULL

The element type of collection columns (SET, MULTISET, LIST). A collection whose elements may have several types has one row per element type.

Column Type Description
attr_name VARCHAR(255) Column name.
class_name VARCHAR(255) Table name.
attr_type VARCHAR(8) 'INSTANCE', 'CLASS' or 'SHARED'.
data_type VARCHAR(9) Element type.
prec INTEGER Element precision.
scale INTEGER Element scale.
code_set INTEGER Charset ID of a character element type.
domain_class_name VARCHAR(255) For an object element type, the referenced table.
CREATE TABLE gift_box (id INT, tags SET(VARCHAR(20)), sizes LIST(INT));
SELECT attr_name, data_type, prec FROM db_attr_setdomain_elm WHERE class_name = 'gift_box' ORDER BY attr_name;
attr_name data_type prec
sizes INTEGER 10
tags STRING 20
Column Type Description
charset_id INTEGER Charset ID.
charset_name VARCHAR(32) Charset name.
default_collation VARCHAR(32) Default collation.
char_size INTEGER Maximum size of one character in bytes.
SELECT * FROM db_charset;
charset_id charset_name default_collation char_size
2 binary binary 1
3 iso88591 iso88591_bin 1
4 euckr euckr_bin 3
5 utf8 utf8_bin 4
Column Type Description
coll_id INTEGER Collation ID.
coll_name VARCHAR(255) Collation name.
charset_name VARCHAR(255) Charset.
is_builtin VARCHAR(3) 'Yes' for a built-in collation, 'No' for a collation from a locale library.
has_expansions VARCHAR(3) 'Yes' if the collation uses expansions.
contractions INTEGER Number of contractions.
uca_strength VARCHAR(255) 'Not applicable', 'Primary', 'Secondary', 'Tertiary', 'Quaternary', 'Identity' or 'Unknown'.

The collations of the utf8 charset:

SELECT coll_id, coll_name FROM db_collation WHERE charset_name = 'utf8' ORDER BY coll_id;
coll_id coll_name
1 utf8_bin
4 utf8_en_cs
5 utf8_en_ci
6 utf8_tr_cs
7 utf8_ko_cs

Methods, mainly those of the system classes.

Column Type Description
meth_name VARCHAR(255) Method name.
class_name VARCHAR(255) Table name.
meth_type VARCHAR(8) 'INSTANCE' or 'CLASS'.
from_class_name VARCHAR(255) For an inherited method, the superclass that defines it; otherwise NULL.
from_meth_name VARCHAR(255) For an inherited method renamed to resolve a name conflict, its name in the superclass; otherwise NULL.
func_name VARCHAR(255) Name of the C function.
SELECT meth_name, meth_type, func_name
FROM db_method
WHERE class_name = 'db_user'
ORDER BY meth_type, meth_name;
meth_name meth_type func_name
add_user CLASS au_add_user_method
drop_user CLASS au_drop_user_method
find_user CLASS au_find_user_method
login CLASS au_login_method
add_member INSTANCE au_add_member_method
drop_member INSTANCE au_drop_member_method
print_authorizations INSTANCE au_describe_user_method
set_password INSTANCE au_set_password_method
set_password_encoded INSTANCE au_set_password_encoded_method
set_password_encoded_sha1 INSTANCE au_set_password_encoded_sha1_method

Method arguments and return values.

Column Type Description
meth_name VARCHAR(255) Method name.
class_name VARCHAR(255) Table name.
meth_type VARCHAR(8) 'INSTANCE' or 'CLASS'.
index_of INTEGER 0 for the return value, 1 and up for input arguments.
data_type VARCHAR(9) Data type.
prec INTEGER Precision.
scale INTEGER Scale.
code_set INTEGER Charset ID of a character type.
domain_class_name VARCHAR(255) For an object type, the referenced table.

The element type of method arguments that are collections. Same columns as DB_METH_ARG, with data_type, prec, scale, code_set and domain_class_name describing the element.

Files that contain method functions.

Column Type Description
class_name VARCHAR(255) Table name.
path_name VARCHAR(255) Path of the file.
from_class_name VARCHAR(255) For inherited file information, the superclass that defines it; otherwise NULL.

Indexes, including those of primary keys, unique and foreign key constraints.

Column Type Description
index_name VARCHAR(255) Index name.
is_unique VARCHAR(3) 'YES' for a unique index or primary key.
is_shared VARCHAR(3) 'YES' if the index is shared by a table hierarchy (primary keys, unique and shared indexes).
is_reverse VARCHAR(3) 'YES' for a reverse index.
class_name VARCHAR(255) Table name.
key_count INTEGER Number of key columns.
is_primary_key VARCHAR(3) 'YES' for a primary key.
is_foreign_key VARCHAR(3) 'YES' for a foreign key.
filter_expression VARCHAR(255) Condition of a filtered index.
have_function VARCHAR(3) 'YES' for a function-based index.
comment VARCHAR(1024) Index comment.
status VARCHAR(255) 'NORMAL INDEX', 'INVISIBLE INDEX', 'INDEX IS IN ONLINE BUILDING' or 'NO_INDEX'.
SELECT index_name, is_unique, is_primary_key, is_foreign_key, key_count
FROM db_index
WHERE class_name = 'order_items'
ORDER BY index_name;
index_name is_unique is_primary_key is_foreign_key key_count
fk_order_items_order_id NO NO YES 1
fk_order_items_product_id NO NO YES 1
pk_order_items_order_id_product_id YES YES NO 2

SHOW INDEX also lists the indexes of a table, with their statistics.

Key columns of indexes.

Column Type Description
index_name VARCHAR(255) Index name.
class_name VARCHAR(255) Table name.
key_attr_name VARCHAR(255) Key column.
key_order INTEGER Position of the column in the key, from 0.
asc_desc VARCHAR(4) 'ASC' or 'DESC'.
key_prefix_length INTEGER Prefix length used as key, or -1 if the whole value is used.
func VARCHAR(255) Expression of a function-based index key.
SELECT index_name, key_attr_name, key_order, asc_desc
FROM db_index_key
WHERE class_name = 'order_items'
ORDER BY index_name, key_order;
index_name key_attr_name key_order asc_desc
fk_order_items_order_id order_id 0 ASC
fk_order_items_product_id product_id 0 ASC
pk_order_items_order_id_product_id order_id 0 ASC
pk_order_items_order_id_product_id product_id 1 ASC

Permissions granted on tables.

Column Type Description
grantor_name VARCHAR(255) User who granted the permission.
grantee_name VARCHAR(255) User or group who received it.
class_name VARCHAR(255) Table name.
auth_type VARCHAR(7) SELECT, INSERT, UPDATE, DELETE, ALTER, INDEX or EXECUTE.
is_grantable VARCHAR(3) 'YES' if the grantee may grant the permission to others.
SELECT grantor_name, grantee_name, auth_type, is_grantable
FROM db_auth
WHERE class_name = 'db_trig';
grantor_name grantee_name auth_type is_grantable
DBA PUBLIC SELECT NO

See GRANT and REVOKE.

Triggers on tables.

Column Type Description
trigger_name VARCHAR(255) Trigger name.
target_class_name VARCHAR(255) Target table.
target_attr_name VARCHAR(255) Target column, or NULL if none is given.
target_attr_type VARCHAR(8) 'INSTANCE' or 'CLASS' if a target column is given.
action_type INTEGER 1 INSERT, UPDATE or DELETE statement, 2 REJECT, 3 INVALIDATE TRANSACTION, 4 PRINT.
action_time INTEGER 1 BEFORE, 2 AFTER, 3 DEFERRED.
comment VARCHAR(1024) Trigger comment.
SELECT trigger_name, target_class_name, target_attr_name, action_type, action_time
FROM db_trig
WHERE target_class_name = 'order_items';
trigger_name target_class_name target_attr_name action_type action_time
trg_order_items_qty_log order_items quantity 1 2
trg_qty_check order_items NULL 2 1

The status, priority, event and condition of triggers are in db_trigger. See Triggers.

Partitions of partitioned tables; one row per partition.

Column Type Description
class_name VARCHAR(255) Partitioned table.
partition_name VARCHAR(255) Partition name.
partition_class_name VARCHAR(255) Name of the partition's own table, <table>__p__<partition>.
partition_type VARCHAR(32) 'HASH', 'RANGE' or 'LIST'.
partition_expr VARCHAR(2048) Partitioning expression.
partition_values SEQUENCE For a range partition, the lower and upper bound (NULL for MINVALUE and MAXVALUE); for a list partition, its values.
comment VARCHAR(1024) Partition comment.
CREATE TABLE order_archive (id INT, order_date DATE, shipping_cost NUMERIC(10,2))
PARTITION BY RANGE (YEAR(order_date)) (
PARTITION before_2023 VALUES LESS THAN (2023),
PARTITION before_2025 VALUES LESS THAN (2025),
PARTITION after_2025 VALUES LESS THAN MAXVALUE
);
SELECT partition_name, partition_class_name, partition_type, partition_expr, partition_values
FROM db_partition
WHERE class_name = 'order_archive'
ORDER BY partition_name;
partition_name partition_class_name partition_type partition_expr partition_values
after_2025 order_archive__p__after_2025 RANGE year([order_date]) {2025, NULL}
before_2023 order_archive__p__before_2023 RANGE year([order_date]) {NULL, 2023}
before_2025 order_archive__p__before_2025 RANGE year([order_date]) {2023, 2025}

See Partitioning.

Java stored functions and procedures.

Column Type Description
sp_name VARCHAR(255) Name.
sp_type VARCHAR(16) 'FUNCTION' or 'PROCEDURE'.
return_type VARCHAR(16) Return type; 'void' for procedures, 'CURSOR' for a cursor.
arg_count INTEGER Number of arguments.
lang VARCHAR(16) 'JAVA'.
target VARCHAR(4096) The Java method that is called.
owner VARCHAR(256) Owner.
comment VARCHAR(1024) Comment.

The stored functions of the current user:

SELECT sp_name, target FROM db_stored_procedure
WHERE sp_type = 'FUNCTION' AND owner = CURRENT_USER;

See Java stored functions and procedures.

Arguments of stored functions and procedures.

Column Type Description
sp_name VARCHAR(255) Name of the stored function or procedure.
index_of INTEGER Position of the argument, from 0.
arg_name VARCHAR(256) Argument name.
data_type VARCHAR(16) Data type.
mode VARCHAR(6) 'IN', 'OUT' or 'INOUT'.
comment VARCHAR(1024) Argument comment.

The arguments of a stored procedure in order:

SELECT index_of, arg_name, data_type, mode
FROM db_stored_procedure_args
WHERE sp_name = 'phone_info'
ORDER BY index_of;