# Individual table description

This section individually describes each table.

## _attributes table

Table to store (key,value) pairs (keys starting with '_' are reserved)

The following table describes the columns:

Column name | Type | Key | Can be NULL | description
--- | --- | --- | --- | ---
att_name | string | Yes | No |
att_value | string |  | No |

## _information_schema_catalog_name table

Name of the current database (current catalog), has only one row

The following table describes the columns:

Column name | Type | Key | Can be NULL | description
--- | --- | --- | --- | ---
catalog_name | string | Yes | No |

## _schemata table

List of schemas

The following table describes the columns:

Column name | Type | Key | Can be NULL | description
--- | --- | --- | --- | ---
catalog_name | string | Yes | No | Name of the catalog that contains the schema
schema_name | string | Yes | No |
schema_owner | string |  | Yes | Name of the schema
schema_internal | boolean |  | No | Tells if the schema is specific to the database implementation (and usually can't be modified)
schema_default | boolean |  | Yes | Tells if the schema is used by default when creating a new table without schema name

- (catalog_name) references _information_schema_catalog_name(catalog_name)

## _builtin_data_types table

List of built-in data types such as varchar, int, ...

The following table describes the columns:

Column name | Type | Key | Can be NULL | description
--- | --- | --- | --- | ---
short_type_name | string |  | No | Short name of the data type
full_type_name | string | Yes | No | Full name of the data type
gtype | string |  | Yes |
comments | text |  | Yes |
synonyms | string |  | Yes |
internal | boolean |  | No | Tells if the data type is reserved for the database implementation and should not be used in applications

## _udt table

User defined data types

The following table describes the columns:

Column name | Type | Key | Can be NULL | description
--- | --- | --- | --- | ---
udt_catalog | string | Yes | No | Name of the catalog that contains the data type
udt_schema | string | Yes | No | Name of the schema that contains the data type
udt_name | string | Yes | No | Name of the data type
udt_gtype | string |  | Yes | GType associated to the data type
udt_comments | text |  | Yes |
udt_short_name | string |  | No |
udt_full_name | string |  | No |
udt_internal | boolean |  | No | Tells if the data type is reserved for the database implementation and should not be used in applications
udt_owner | string |  | Yes |

- (udt_catalog, udt_schema) references _schemata(catalog_name, schema_name)

## _udt_columns table

List of components for a user defined data type for composed data types (such as a complex number data type which has real and imaginary parts)

The following table describes the columns:

Column name | Type | Key | Can be NULL | description
--- | --- | --- | --- | ---
udt_catalog | string | Yes | No | Name of the catalog that contains the user defined data type for which the column is
udt_schema | string | Yes | No | Name of the schema that contains the user defined data type for which the column is
udt_name | string | Yes | No | Name of the user defined data type for which the column is
udt_column | string | Yes | No | Name of the column (part)
ordinal_position | gint |  | No | Column position, starts at 1
data_type | string |  | Yes | Data type of the column (if the column is an array, then 'array_spec' is set, and this may be NULL)
array_spec | string |  | Yes | Array description if the column is an array
character_maximum_length | gint |  | Yes |
character_octet_length | gint |  | Yes |
numeric_precision | gint |  | Yes |
numeric_scale | gint |  | Yes |
datetime_precision | gint |  | Yes |
character_set_catalog | string |  | Yes |
character_set_schema | string |  | Yes |
character_set_name | string |  | Yes |
collation_catalog | string |  | Yes |
collation_schema | string |  | Yes |
collation_name | string |  | Yes |

- (udt_catalog, udt_schema, udt_name) references _udt(udt_catalog, udt_schema, udt_name)

- (array_spec) references _element_types(specific_name)

## _enums table

List of possible enumeration labels for enumerations

The following table describes the columns:

Column name | Type | Key | Can be NULL | description
--- | --- | --- | --- | ---
udt_catalog | string | Yes | No | Name of the catalog that contains the ENUM user defined data type
udt_schema | string | Yes | No | Name of the schema that contains the ENUM user defined data type
udt_name | string | Yes | No | Name of the ENUM user defined data type
label | string | Yes | No |
ordinal_position | gint |  | No | Position, starts at 1

- (udt_catalog, udt_schema, udt_name) references _udt(udt_catalog, udt_schema, udt_name)

## _element_types table

Array specific attributes for array data types

The following table describes the columns:

Column name | Type | Key | Can be NULL | description
--- | --- | --- | --- | ---
specific_name | string | Yes | No | No specific meaning, used as a primary key, and for joining
object_catalog | string |  | No | Name of the catalog that contains the object that uses the array being described
object_schema | string |  | No | Name of the schema that contains the object that uses the array being described
object_name | string |  | No | Name of the object that uses the array being described
object_type | string |  | No | The type of the object that uses the array being described TABLE_COL, DOMAIN, UDT_COL, ROUTINE_COL, ROUTINE_PAR
data_type | string |  | Yes | Base data type of the array (if the base data type is an array, then 'array_spec' is set, and this may be NULL)
array_spec | string |  | Yes | Array description if the base data type is an array
min_cardinality | gint |  | Yes |
max_cardinality | gint |  | Yes |

## _domains table

List of domains

The following table describes the columns:

Column name | Type | Key | Can be NULL | description
--- | --- | --- | --- | ---
domain_catalog | string | Yes | No | Name of catalog that contains the domain
domain_schema | string | Yes | No | Name of schema that contains the domain
domain_name | string | Yes | No | Name of the domain
data_type | string |  | Yes | Data type of the domain (if the domain is an array, then 'array_spec' is set, and this may be NULL)
array_spec | string |  | Yes | Array description if the domain is an array
domain_gtype | string |  | No |
character_maximum_length | gint |  | Yes |
character_octet_length | gint |  | Yes |
collation_catalog | string |  | Yes | Name of catalog that contains the associated collation
collation_schema | string |  | Yes | Name of schema that contains the associated collation
collation_name | string |  | Yes | Name of the associated collation
character_set_catalog | string |  | Yes | Name of catalog that contains the associated character set
character_set_schema | string |  | Yes | Name of schema that contains the associated character set
character_set_name | string |  | Yes | Name of the associated character set
numeric_precision | gint |  | Yes |
numeric_scale | gint |  | Yes |
domain_default | string |  | Yes |
domain_comments | text |  | Yes |
domain_short_name | string |  | No |
domain_full_name | string |  | No |
domain_internal | boolean |  | No |
domain_owner | string |  | Yes |

- (domain_catalog, domain_schema) references _schemata(catalog_name, schema_name)

- (array_spec) references _element_types(specific_name)

## _tables table

List of tables (tables, views or other objects which can contain data)

The following table describes the columns:

Column name | Type | Key | Can be NULL | description
--- | --- | --- | --- | ---
table_catalog | string | Yes | No | Name of catalog that contains the table
table_schema | string | Yes | No | Name of schema that contains the table
table_name | string | Yes | No | Name of the table
table_type | string |  | No | Type of table: BASE TABLE, VIEW, LOCAL TEMPORARY, SYSTEM TABLE, GLOBAL TEMPORARY, ALIAS or SYNONYM
is_insertable_into | boolean |  | Yes | Tells if the table's contents can be modified
table_comments | text |  | Yes |
table_short_name | string |  | No |
table_full_name | text |  | No |
table_owner | string |  | Yes |

- (table_catalog, table_schema) references _schemata(catalog_name, schema_name)

## _views table

List of views and their specific information

The following table describes the columns:

Column name | Type | Key | Can be NULL | description
--- | --- | --- | --- | ---
table_catalog | string | Yes | No | Name of catalog that contains the view
table_schema | string | Yes | No | Name of schema that contains the view
table_name | string | Yes | No | Name of the view
view_definition | text |  | Yes | View as SQL
check_option | string |  | Yes | CASCADE if the statement used to create the view included the WITH CHECK OPTION; otherwise, NONE
is_updatable | boolean |  | Yes | Tells if the view's contents can be modified

- (table_catalog, table_schema, table_name) references _tables(table_catalog, table_schema, table_name)

## _collations table

List of collations methods

The following table describes the columns:

Column name | Type | Key | Can be NULL | description
--- | --- | --- | --- | ---
collation_catalog | string | Yes | No |
collation_schema | string | Yes | No |
collation_name | string | Yes | No |
collation_comments | text |  | Yes |
collation_short_name | string |  | No |
collation_full_name | string |  | No |

- (collation_catalog, collation_schema) references _schemata(catalog_name, schema_name)

## _character_sets table

List of character sets

The following table describes the columns:

Column name | Type | Key | Can be NULL | description
--- | --- | --- | --- | ---
character_set_catalog | string | Yes | No |
character_set_schema | string | Yes | No |
character_set_name | string | Yes | No |
default_collate_catalog | string |  | Yes |
default_collate_schema | string |  | Yes |
default_collate_name | string |  | Yes |
character_set_comments | text |  | Yes |
character_set_short_name | string |  | No |
character_set_full_name | string |  | No |

- (character_set_catalog, character_set_schema) references _schemata(catalog_name, schema_name)

- (default_collate_catalog, default_collate_schema, default_collate_name) references _collations(collation_catalog, collation_schema, collation_name)

## _routines table

List of functions and stored procedures (note: the primary jey for that table is composed of (specific_catalog, specific_schema, specific_name))

The following table describes the columns:

Column name | Type | Key | Can be NULL | description
--- | --- | --- | --- | ---
specific_catalog | string | Yes | No | Specific name of catalog that contains the routine
specific_schema | string | Yes | No | Specific name of schema that contains the routine
specific_name | string | Yes | No | Specific name of the routine (may be mangled for polymorphic routines)
routine_catalog | string |  | Yes | Name of catalog that contains the routine (may be NULL)
routine_schema | string |  | Yes | Name of schema that contains the routine (may be NULL)
routine_name | string |  | No | Name of the routine
routine_type | string |  | Yes | FUNCTION, PROCEDURE, AGGREGATE
return_type | string |  | Yes | Data type returned by the routine (may be NULL if routine does not return any value)
returns_set | boolean |  | No | True if routine returns a set (i.e., multiple values of the specified data type or if data type may vary)
nb_args | gint |  | No | Number of arguments (-1 for variable number of arguments)
routine_body | text |  | Yes | If the routine is an SQL function, then SQL, else EXTERNAL
routine_definition | text |  | Yes | The source text of the routine
external_name | string |  | Yes | If the routine is an external function, then the external name (link symbol) of the function
external_language | string |  | Yes | The language the routine is written in
parameter_style | string |  | Yes | Parameter style (GENERAL, JAVA, SQL, GENERAL WITH NULLS)
is_deterministic | boolean |  | Yes | Tells if the routine returns the same results given the same arguments forever
sql_data_access | string |  | Yes | Whether the routine contains SQL and whether it reads or modifies data (NONE, CONTAINS, READS, MODIFIES)
is_null_call | boolean |  | Yes | Tells if the routine will be called if any one of its arguments is NULL
routine_comments | text |  | Yes |
routine_short_name | text |  | No |
routine_full_name | text |  | No |
routine_owner | string |  | Yes |

- (specific_catalog, specific_schema) references _schemata(catalog_name, schema_name)

## _triggers table

List of triggers

The following table describes the columns:

Column name | Type | Key | Can be NULL | description
--- | --- | --- | --- | ---
trigger_catalog | string | Yes | No |
trigger_schema | string | Yes | No |
trigger_name | string | Yes | No |
event_manipulation | string | Yes | No | Event that fires the trigger (INSERT, UPDATE, or DELETE)
event_object_catalog | string | Yes | No | Name of the database that contains the table that the trigger is defined on
event_object_schema | string | Yes | No | Name of the schema that contains the table that the trigger is defined on
event_object_table | string | Yes | No | Name of the table that the trigger is defined on
action_statement | text |  | Yes | Statement that is executed by the trigger
action_orientation | string |  | No | Identifies whether the trigger fires once for each processed row or once for each statement (ROW or STATEMENT)
condition_timing | string |  | No | Time at which the trigger fires (BEFORE or AFTER)
trigger_comments | text |  | Yes |
trigger_short_name | string |  | No |
trigger_full_name | string |  | No |

- (trigger_catalog, trigger_schema) references _schemata(catalog_name, schema_name)

- (event_object_catalog, event_object_schema, event_object_table) references _tables(table_catalog, table_schema, table_name)

## _columns table

List of columns composing tables

The following table describes the columns:

Column name | Type | Key | Can be NULL | description
--- | --- | --- | --- | ---
table_catalog | string | Yes | No |
table_schema | string | Yes | No |
table_name | string | Yes | No |
column_name | string | Yes | No |
ordinal_position | gint |  | No | Column position, starts at 1
column_default | string |  | Yes |
is_nullable | boolean |  | No |
data_type | string |  | Yes | Data type of the column (if the column is an array, then 'array_spec' is set, and this may be NULL)
array_spec | string |  | Yes | Array description if the column is an array
gtype | string |  | No |
character_maximum_length | gint |  | Yes |
character_octet_length | gint |  | Yes |
numeric_precision | gint |  | Yes | If data_type identifies a numeric type, this column contains the precision of the type for this column (the number of significant digits)
numeric_scale | gint |  | Yes | If data_type identifies an exact numeric type, this column contains the scale of the type for this column (the number of significant digits to the right of the decimal point)
datetime_precision | gint |  | Yes |
character_set_catalog | string |  | Yes |
character_set_schema | string |  | Yes |
character_set_name | string |  | Yes |
collation_catalog | string |  | Yes |
collation_schema | string |  | Yes |
collation_name | string |  | Yes |
extra | string |  | Yes | CSV string with: AUTO_INCREMENT
is_updatable | boolean |  | Yes |
column_comments | text |  | Yes |

- (table_catalog, table_schema, table_name) references _tables(table_catalog, table_schema, table_name)

- (character_set_catalog, character_set_schema, character_set_name) references _character_sets(character_set_catalog, character_set_schema, character_set_name)

- (collation_catalog, collation_schema, collation_name) references _collations(collation_catalog, collation_schema, collation_name)

- (array_spec) references _element_types(specific_name)

## _table_constraints table

List of constraints applied to tables (Check, primary or foreign key, or unique constraints)

The following table describes the columns:

Column name | Type | Key | Can be NULL | description
--- | --- | --- | --- | ---
constraint_catalog | string |  | Yes | Name of the catalog that contains the constraint
constraint_schema | string |  | Yes | Name of the schema that contains the constraint
constraint_name | string | Yes | No |
table_catalog | string | Yes | No |
table_schema | string | Yes | No |
table_name | string | Yes | No |
constraint_type | string |  | No | CHECK, FOREIGN KEY, PRIMARY KEY or UNIQUE
check_clause | text |  | Yes | The check expression if the constraint is a check constraint, NULL otherwise
is_deferrable | boolean |  | Yes |
initially_deferred | boolean |  | Yes |

- (table_catalog, table_schema, table_name) references _tables(table_catalog, table_schema, table_name)

## _referential_constraints table

List of foreign key constraints, along with some specific attributes

The following table describes the columns:

Column name | Type | Key | Can be NULL | description
--- | --- | --- | --- | ---
table_catalog | string | Yes | No |
table_schema | string | Yes | No |
table_name | string | Yes | No |
constraint_name | string | Yes | No |
ref_table_catalog | string |  | No |
ref_table_schema | string |  | No |
ref_table_name | string |  | No |
ref_constraint_name | string |  | No |
match_option | string |  | Yes | FULL, PARTIAL or NONE
update_rule | string |  | Yes | CASCADE, SET NULL, SET DEFAULT, RESTRICT, NO ACTION or NONE
delete_rule | string |  | Yes | CASCADE, SET NULL, SET DEFAULT, RESTRICT, NO ACTION or NONE

- (table_catalog, table_schema, table_name, constraint_name) references _table_constraints(table_catalog, table_schema, table_name, constraint_name)

- (ref_table_catalog, ref_table_schema, ref_table_name, ref_constraint_name) references _table_constraints(table_catalog, table_schema, table_name, constraint_name)

## _key_column_usage table

List of primary key constraints and the name of the tables' columns involved

The following table describes the columns:

Column name | Type | Key | Can be NULL | description
--- | --- | --- | --- | ---
table_catalog | string | Yes | No |
table_schema | string | Yes | No |
table_name | string | Yes | No |
constraint_name | string | Yes | No |
column_name | string | Yes | No |
ordinal_position | gint | Yes | No | Ordinal position of the column within the constraint key (count starts at 1)

- (table_catalog, table_schema, table_name, constraint_name) references _table_constraints(table_catalog, table_schema, table_name, constraint_name)

- (table_catalog, table_schema, table_name, column_name) references _columns(table_catalog, table_schema, table_name, column_name)

## __declared_fk table

List of foreign key constraints, declared in Libgda and unknown to the database

The following table describes the columns:

Column name | Type | Key | Can be NULL | description
--- | --- | --- | --- | ---
constraint_name | string | Yes | No |
table_catalog | string | Yes | No |
table_schema | string | Yes | No |
table_name | string | Yes | No |
column_name | string | Yes | No |
ref_table_catalog | string | Yes | No |
ref_table_schema | string | Yes | No |
ref_table_name | string | Yes | No |
ref_column_name | string | Yes | No |
ts | timestamp |  | Yes |
descr | string |  | Yes |

## _check_column_usage table

List of check constraints and the name of the tables' columns involved

The following table describes the columns:

Column name | Type | Key | Can be NULL | description
--- | --- | --- | --- | ---
table_catalog | string | Yes | No |
table_schema | string | Yes | No |
table_name | string | Yes | No |
constraint_name | string | Yes | No |
column_name | string | Yes | No |

- (table_catalog, table_schema, table_name, constraint_name) references _table_constraints(table_catalog, table_schema, table_name, constraint_name)

- (table_catalog, table_schema, table_name, column_name) references _columns(table_catalog, table_schema, table_name, column_name)

## _view_column_usage table

List of the tables' columns involved in a view

The following table describes the columns:

Column name | Type | Key | Can be NULL | description
--- | --- | --- | --- | ---
view_catalog | string | Yes | No |
view_schema | string | Yes | No |
view_name | string | Yes | No |
table_catalog | string | Yes | No |
table_schema | string | Yes | No |
table_name | string | Yes | No |
column_name | string | Yes | No |

- (view_catalog, view_schema, view_name) references _views(table_catalog, table_schema, table_name)

- (table_catalog, table_schema, table_name, column_name) references _columns(table_catalog, table_schema, table_name, column_name)

## _domain_constraints table

List of constraints applicable to domains

The following table describes the columns:

Column name | Type | Key | Can be NULL | description
--- | --- | --- | --- | ---
constraint_catalog | string |  | Yes | Name of the catalog that contains the constraint
constraint_schema | string |  | Yes | Name of the schema that contains the constraint
constraint_name | string | Yes | No |
domain_catalog | string | Yes | No |
domain_schema | string | Yes | No |
domain_name | string | Yes | No |
check_clause | string |  | Yes |
is_deferrable | boolean |  | Yes |
initially_deferred | boolean |  | Yes |

- (domain_catalog, domain_schema, domain_name) references _domains(domain_catalog, domain_schema, domain_name)

- (constraint_catalog, constraint_schema) references _schemata(catalog_name, schema_name)

## _parameters table

List of routines' (functions and stored procedures) parameters (may not contain data for some routines which accept any type of parameter)

The following table describes the columns:

Column name | Type | Key | Can be NULL | description
--- | --- | --- | --- | ---
specific_catalog | string | Yes | No |
specific_schema | string | Yes | No |
specific_name | string | Yes | No |
ordinal_position | gint | Yes | No |
parameter_mode | string |  | No |
parameter_name | string |  | Yes |
data_type | string |  | Yes | Data type of the parameter (if the parameter is an array, then 'array_spec' is set, and this may be NULL; can also be NULL if any type of parameter is accepted)
array_spec | string |  | Yes | Array description if the parameter is an array

- (specific_catalog, specific_schema, specific_name) references _routines(specific_catalog, specific_schema, specific_name)

- (array_spec) references _element_types(specific_name)

## _routine_columns table

List of routines' (functions and stored procedures) returned values' parts (columns) for routines returning composed values

The following table describes the columns:

Column name | Type | Key | Can be NULL | description
--- | --- | --- | --- | ---
specific_catalog | string | Yes | No |
specific_schema | string | Yes | No |
specific_name | string | Yes | No |
column_name | string | Yes | No |
ordinal_position | gint | Yes | Yes |
data_type | string |  | Yes | Data type of the column (if the column is an array, then 'array_spec' is set, and this may be NULL)
array_spec | string |  | Yes | Array description if the column is an array

- (specific_catalog, specific_schema, specific_name) references _routines(specific_catalog, specific_schema, specific_name)

- (array_spec) references _element_types(specific_name)

## _table_indexes table

List of tables' indexes which do not relate to primary keys

The following table describes the columns:

Column name | Type | Key | Can be NULL | description
--- | --- | --- | --- | ---
index_catalog | string |  | Yes | Name of the catalog that contains the index
index_schema | string |  | Yes | Name of the schema that contains the index
index_name | string | Yes | No |
table_catalog | string | Yes | No |
table_schema | string | Yes | No |
table_name | string | Yes | No |
is_unique | boolean |  | Yes |
index_def | string |  | Yes | Index definition
index_type | string |  | Yes | Database specific type of index such as BTREE, ...
extra | string |  | Yes | CSV string with: ASCENDING, ...
index_owner | string |  | Yes |
index_comments | text |  | Yes |

- (table_catalog, table_schema, table_name) references _tables(table_catalog, table_schema, table_name)

## _index_column_usage table

List of the tables' columns involved in an index listed in the _table_indexes table

The following table describes the columns:

Column name | Type | Key | Can be NULL | description
--- | --- | --- | --- | ---
index_catalog | string |  | Yes |
index_schema | string |  | Yes |
index_name | string | Yes | No |
table_catalog | string | Yes | No |
table_schema | string | Yes | No |
table_name | string | Yes | No |
column_name | string | Yes | Yes |
column_expr | string | Yes | Yes |
ordinal_position | gint |  | No | Column position in the index, starts at 1

- (index_name, table_catalog, table_schema, table_name) references _table_indexes(index_name, table_catalog, table_schema, table_name)

## _all_types view

List of all the data types

Definition is:

    SELECT short_type_name AS short_type_name, gtype, full_type_name AS full_type_name, comments, internal AS internal, synonyms,
           NULL AS domain_catalog, NULL AS domain_schema, NULL AS domain_name,
           NULL AS udt_catalog, NULL AS udt_schema, NULL AS udt_name
           FROM _builtin_data_types
    UNION
    SELECT udt_short_name, udt_gtype, udt_full_name, udt_comments, udt_internal, NULL,
           NULL, NULL, NULL, udt_catalog, udt_schema, udt_name FROM _udt
    UNION
    SELECT domain_short_name, domain_gtype, domain_full_name, domain_comments, domain_internal, NULL,
           domain_catalog, domain_schema, domain_name , NULL, NULL, NULL FROM _domains

## _detailed_fk view

For each foreign key constraint, lists all the tables' columns involved and the constraint name

Definition is:

    SELECT rc.table_catalog as fk_table_catalog, rc.table_schema as fk_table_schema, rc.table_name as fk_table_name, kc1.column_name as fk_column,
          rc.ref_table_catalog as ref_table_catalog, rc.ref_table_schema as ref_table_schema, rc.ref_table_name as ref_table_name, kc2.column_name as ref_column,
          rc.constraint_name as fk_constraint_name, kc1.ordinal_position as ordinal_position
          FROM _referential_constraints rc
          INNER JOIN _key_column_usage kc2 ON (rc.ref_table_catalog=kc2.table_catalog AND rc.ref_table_schema=kc2.table_schema AND rc.ref_table_name=kc2.table_name AND rc.ref_constraint_name=kc2.constraint_name)
          INNER JOIN _key_column_usage kc1 ON (rc.table_catalog=kc1.table_catalog AND rc.table_schema=kc1.table_schema AND rc.table_name=kc1.table_name AND rc.constraint_name=kc1.constraint_name)
          WHERE kc1.ordinal_position = kc2.ordinal_position
          ORDER BY rc.table_catalog, rc.table_schema, rc.table_name, kc1.ordinal_position