- Appendix D: System Tables
RDB$BACKUP_HISTORY
RDB$CHARACTER_SETS
RDB$CHECK_CONSTRAINTS
RDB$COLLATIONS
RDB$DATABASE
RDB$DEPENDENCIES
RDB$EXCEPTIONS
RDB$FIELDS
RDB$FIELD_DIMENSIONS
RDB$FILES
RDB$FILTERS
RDB$FORMATS
RDB$FUNCTIONS
RDB$FUNCTION_ARGUMENTS
RDB$GENERATORS
RDB$INDICES
RDB$INDEX_SEGMENTS
RDB$LOG_FILES
RDB$PAGES
RDB$PROCEDURES
RDB$PROCEDURE_PARAMETERS
RDB$REF_CONSTRAINTS
RDB$RELATIONS
RDB$RELATION_CONSTRAINTS
RDB$RELATION_FIELDS
RDB$ROLES
RDB$SECURITY_CLASSES
RDB$TRANSACTIONS
RDB$TRIGGERS
RDB$TRIGGER_MESSAGES
RDB$TYPES
RDB$USER_PRIVILEGES
RDB$VIEW_RELATIONS
Appendix D: System Tables
When you create a database, the Firebird engine creates a lot of system tables. Metadata — the descriptions and attributes of all database objects — are stored in these system tables.
System table identifiers all begin with the prefix RDB$
.
List of System Tables
RDB$BACKUP_HISTORY
History of backups performed using nBackup
RDB$CHARACTER_SETS
Names and describes the character sets available in the database
RDB$CHECK_CONSTRAINTS
Cross references between the names of constraints (NOT NULL
constraints, CHECK
constraints and ON UPDATE
and ON DELETE
clauses in foreign key constraints) and their associated system-generated triggers
RDB$COLLATIONS
Collation sequences for all character sets
RDB$DATABASE
Basic information about the database
RDB$DEPENDENCIES
Information about dependencies between database objects
RDB$EXCEPTIONS
Custom database exceptions
RDB$FIELDS
Column and domain definitions, both system and custom
RDB$FIELD_DIMENSIONS
Dimensions of array columns
RDB$FILES
Information about secondary files and shadow files
RDB$FILTERS
Information about BLOB filters
RDB$FORMATS
Information about changes in the formats of tables
RDB$FUNCTIONS
Information about external functions
RDB$FUNCTION_ARGUMENTS
Attributes of the parameters of external functions
RDB$GENERATORS
Information about generators (sequences)
RDB$INDEX_SEGMENTS
Segments and index positions
RDB$INDICES
Definitions of all indexes in the database (system- or user-defined)
RDB$LOG_FILES
Not used in the current version
RDB$PAGES
Information about database pages
RDB$PROCEDURE_PARAMETERS
Parameters of stored procedures
RDB$PROCEDURES
Definitions of stored procedures
RDB$REF_CONSTRAINTS
Definitions of referential constraints (foreign keys)
RDB$RELATION_CONSTRAINTS
Definitions of all table-level constraints
RDB$RELATION_FIELDS
Top-level definitions of table columns
RDB$RELATIONS
Headers of tables and views
RDB$ROLES
Role definitions
RDB$SECURITY_CLASSES
Access control lists
RDB$TRANSACTIONS
State of multi-database transactions
RDB$TRIGGER_MESSAGES
Trigger messages
RDB$TRIGGERS
Trigger definitions
RDB$TYPES
Definitions of enumerated data types
RDB$USER_PRIVILEGES
SQL privileges granted to system users
RDB$VIEW_RELATIONS
Tables that are referred to in view definitions: one record for each table in a view
RDB$BACKUP_HISTORY
RDB$BACKUP_HISTORY
stores the history of backups performed using the nBackup utility.
Column Name | Data Type | Description |
---|---|---|
|
| The identifier assigned by the engine |
|
| Backup date and time |
|
| Backup level |
|
| Unique identifier |
|
| System (scan) number |
|
| Full path and file name of backup file |
RDB$CHARACTER_SETS
RDB$CHARACTER_SETS
names and describes the character sets available in the database.
Column Name | Data Type | Description |
---|---|---|
|
| Character set name |
|
| Not used |
|
| The number of characters in the set. Not used for existing character sets |
|
| The name of the default collation sequence for the character set |
|
| Unique character set identifier |
|
| System flag: value is 1 if the character set is defined in the system when the database is created; value is 0 for a user-defined character set |
|
| Could store text description of the character set |
|
| For a user-defined character set that is accessed via an external function, the name of the external function |
|
| The maximum number of bytes representing one character |
RDB$CHECK_CONSTRAINTS
RDB$CHECK_CONSTRAINTS
provides the cross references between the names of system-generated triggers for constraints and the names of the associated constraints (NOT NULL
constraints, CHECK
constraints and the ON UPDATE
and ON DELETE
clauses in foreign key constraints).
Column Name | Data Type | Description |
---|---|---|
|
| Constraint name, defined by the user or automatically generated by the system |
|
| For a |
RDB$COLLATIONS
RDB$COLLATIONS
stores collation sequences for all character sets.
Column Name | Data Type | Description |
---|---|---|
|
| Collation sequence name |
|
| Collation sequence identifier. Together with the character set identifier, it is a unique collation sequence identifier |
|
| Character set identifier. Together with the collection sequence identifier, it is a unique identifier |
|
| Collation attributes. It is a bit mask where the first bit shows whether trailing spaces should be taken into account in collations (0 - NO PAD; 1 - PAD SPACE); the second bit shows whether the collation is case-sensitive (0 - CASE SENSITIVE, 1 - CASE INSENSITIVE); the third bit shows whether the collation is accent-sensitive (0 - ACCENT SENSITIVE, 1 - ACCENT SENSITIVE). Thus, the value of 5 means that the collation does not take into account trailing spaces and is accent-insensitive |
|
| Flag: the value of 0 means it is user-defined; the value of 1 means it is system-defined |
|
| Could store text description of the collation sequence |
|
| Not currently used |
|
| The name of the base collation sequence for this collation sequence |
|
| Describes specific attributes |
RDB$DATABASE
RDB$DATABASE
stores basic information about the database. It contains only one record.
Column Name | Data Type | Description |
---|---|---|
|
| Database comment text |
|
| A number that steps up by one each time a table or view is added to the database |
|
| The security class defined in |
|
| The name of the default character set for the database set in the |
RDB$DEPENDENCIES
RDB$DEPENDENCIES
stores the dependencies between database objects.
Column Name | Data Type | Description |
---|---|---|
|
| The name of the view, procedure, trigger, |
|
| The name of the object that the defined object — the table, view, procedure, trigger, |
|
| The column name in the depended-on object that is referred to by the dependent view, procedure, trigger, |
|
| Identifies the type of the dependent object:
|
|
| Identifies the type of the object depended on:
|
RDB$EXCEPTIONS
RDB$EXCEPTIONS
stores custom database exceptions.
Column Name | Data Type | Description |
---|---|---|
|
| Custom exception name |
|
| The unique number of the exception assigned by the system |
|
| Exception message text |
|
| Could store text description of the exception |
|
| Flag:
|
RDB$FIELDS
RDB$FIELDS stores definitions of columns and domains, both system and custom. This is where the detailed data attributes are stored for all columns.
The column |
Column Name | Data Type | Description |
---|---|---|
|
| The unique name of the domain created by the user or of the domain automatically built for the table column by the system. System-created domain names start with the “RDB$” prefix |
|
| Not used |
|
| The binary language representation (BLR) of the SQL expression specifying the check of the |
|
| The original source text in the SQL language specifying the check of the |
|
| The binary language representation (BLR) of the SQL expression the database server uses for evaluation when accessing a |
|
| The original source text of the expression that defines a |
|
| The default value, if any, for the field or domain, in binary language representation (BLR) |
|
| The default value in the source code, as an SQL constant or expression |
|
| Column size in bytes. |
|
| The negative number that specifies the scale for |
|
| Data type code for the column:
Codes for |
|
| Specifies the subtype for the BLOB data type:
Specifies for the CHAR data type:
Specifies the particular data type for the integer data types (
|
|
| Not used |
|
| Not used |
|
| Any domain (table column) comment text |
|
| Flag: the value of 1 means the domain is automatically created by the system, the value of 0 means that the domain is defined by the user |
|
| Not used |
|
| Specifies the length of the |
|
| Not used |
|
| The length of the column in bytes if it belongs to an external table. Always |
|
| The scale factor of an integer-type field in an external table; represents the power of 10 by which the integer is multiplied |
|
| The data type of the field as it is represented in an external table:
|
|
| Defines the number of dimensions in an array if the column is defined as an array. Always |
|
| Specifies whether the column can take an empty value (the field will contain |
|
| The length of |
|
| The identifier of the collation sequence for a character column or domain. If it is not defined, the value of the field will be 0 |
|
| The identifier of the character set for a character column, |
|
| Specifies the total number of digits for the fixed-point numeric data type ( |
RDB$FIELD_DIMENSIONS
RDB$FIELD_DIMENSIONS
stores the dimensions of array columns.
Column Name | Data Type | Description |
---|---|---|
|
| The name of the array column. It must be present in the |
|
| Identifies one dimension in the array column. The numbering of dimensions starts with 0 |
|
| The lower bound of this dimension |
|
| The upper bound of this dimension |
RDB$FILES
RDB$FILES
stores information about secondary files and shadow files.
Column Name | Data Type | Description |
---|---|---|
|
| The full path to the file and the name of either
|
|
| The sequential number of the secondary file in a sequence or of the shadow file in a shadow file set |
|
| The initial page number in the secondary file or shadow file |
|
| File length in database pages |
|
| For internal use |
|
| Shadow set number. If the row describes a database secondary file, the field will be |
RDB$FILTERS
RDB$FILTERS
stores information about BLOB
filters.
Column Name | Data Type | Description |
---|---|---|
|
| The unique identifier of the |
|
| Documentation about the |
|
| The name of the dynamic library or shared object where the code of the |
|
| The exported name of the |
|
| The |
|
| The |
|
| Flag indicating whether the filter is user-defined or internally defined:
|
RDB$FORMATS
RDB$FORMATS
stores information about changes in tables. Each time any metadata change to a table is committed, it gets a new format number. When the format number of any table reaches 255, the entire database becomes inoperable. To return to normal, the database must be backed up with the gbak utility and restored from that backup copy.
Column Name | Data Type | Description |
---|---|---|
|
| Table or view identifier |
|
| Table format identifier — maximum 255. The critical time comes when this number approaches 255 for any table or view |
|
| Stores column names and data attributes as |
RDB$FUNCTIONS
RDB$FUNCTIONS
stores the information needed by the engine about external functions (user-defined functions, UDFs).
In future major releases (Firebird 3.0+) |
Column Name | Data Type | Description |
---|---|---|
|
| The unique (declared) name of the external function |
|
| Not currently used |
|
| Not currently used |
|
| Any text with comments related to the external function |
|
| The name of the dynamic library or shared object where the code of the external function is located |
|
| The exported name of the external function in the function library. Note, this is often not the same as |
|
| The position number of the returned argument in the list of parameters corresponding to input arguments |
|
| Flag indicating whether the filter is user-defined or internally defined:
|
RDB$FUNCTION_ARGUMENTS
RDB$FUNCTION_ARGUMENTS
stores the parameters of external functions and their attributes.
Column Name | Data Type | Description |
---|---|---|
|
| The unique name (declared identifier) of the external function |
|
| The position of the argument in the list of arguments |
|
| Flag: how this argument is passed:
|
|
| Data type code defined for the column:
|
|
| The scale of an integer or a fixed-point argument. It is an exponent of 10 |
|
| Argument length in bytes:
|
|
| Stores the |
|
| The identifier of the character set for a character argument |
|
| The number of digits of precision available for the data type of the argument |
|
| The length of a |
RDB$GENERATORS
RDB$GENERATORS
stores generators (sequences) and keeps them up-to-date.
Column Name | Data Type | Description |
---|---|---|
|
| The unique name of the generator |
|
| The unique identifier assigned to the generator by the system |
|
| Flag:
|
|
| Could store comments related to the generator |
RDB$INDICES
RDB$INDICES
stores definitions of both system- and user-defined indexes. The attributes of each column belonging to an index are stored in one row of the table RDB$INDEX_SEGMENTS
.
Column Name | Data Type | Description |
---|---|---|
|
| The unique name of the index specified by the user or automatically generated by the system |
|
| The name of the table to which the index belongs. It corresponds to an identifier in |
|
| The internal (system) identifier of the index |
|
| Specifies whether the index is unique:
|
|
| Could store comments concerning the index |
|
| The number of segments (columns) in the index |
|
| Indicates whether the index is currently active:
|
|
| Distinguishes between an expression index (1) and a regular index (0 or null). Not used in databases created before Firebird 2.0; hence, regular indexes in upgraded databases are more more likely to store null in this column |
|
| The name of the associated Foreign Key constraint, if any |
|
| Indicates whether the index is system-defined or user-defined:
|
|
| Expression for an expression index, written in the binary language representation (BLR), used for calculating the values for the index at runtime. |
|
| The source code of the expression for an expression index |
|
| Stores the last known selectivity of the entire index, calculated by execution of a |
RDB$INDEX_SEGMENTS
RDB$INDEX_SEGMENTS
stores the segments (table columns) of indexes and their positions in the key. A separate row is stored for each column in an index.
Column Name | Data Type | Description |
---|---|---|
|
| The name of the index this segment is related to. The master record is |
|
| The name of a column belonging to the index, corresponding to an identifier for the table and that column in |
|
| The column position in the index. Positions are numbered left-to-right, starting at zero |
|
| The last known (calculated) selectivity of this column in the index. The higher the number, the lower the selectivity. |
RDB$LOG_FILES
RDB$LOG_FILES
is not currently used.
RDB$PAGES
RDB$PAGES
stores and maintains information about database pages and their usage.
Column Name | Data Type | Description |
---|---|---|
|
| The unique number of a physically created database page |
|
| The identifier of the table to which the page is allocated |
|
| The number of the page in the sequence of all pages allocated to this table |
|
| Indicates the page type (data, index, |
RDB$PROCEDURES
RDB$PROCEDURES
stores the definitions of stored procedures, including their PSQL source code and the binary language representation (BLR) of it. The next table, RDB$PROCEDURE_PARAMETERS
, stores the definitions of input and output parameters.
Column Name | Data Type | Description |
---|---|---|
|
| Stored procedure name (identifier) |
|
| The procedure’s unique, system-generated identifier |
|
| Indicates the number of input parameters. |
|
| Indicates the number of output parameters. |
|
| Any text comments related to the procedure |
|
| The PSQL source code of the procedure |
|
| The binary language representation (BLR) of the procedure code |
|
| May point to the security class defined in the system table |
|
| The user name of the procedure’s Owner — the user who was |
|
| A metadata description of the procedure, used internally for optimization |
|
| Indicates whether the procedure is defined by a user (value 0) or by the system (a value of 1 or greater) |
|
| Procedure type:
for procedures created before Firebird 1.5 |
|
| Indicates whether the source PSQL of the stored procedure remains valid after the latest |
|
| Contains debugging information about variables used in the stored procedure |
RDB$PROCEDURE_PARAMETERS
RDB$PROCEDURE_PARAMETERS
stores the parameters of stored procedures and their attributes. It holds one row for each parameter.
Column Name | Data Type | Description |
---|---|---|
|
| Parameter name |
|
| The name of the procedure where the parameter is defined |
|
| The sequential number of the parameter |
|
| Indicates whether the parameter is for input (value 0) or output (value 1) |
|
| The name of the user-created domain, when a domain is referenced instead of a data type. If the name starts with the prefix “RDB$”, it is the name of the domain automatically generated by the system for the parameter. |
|
| Could store comments related to the parameter |
|
| Indicates whether the parameter was defined by the system (value or greater) or by a user (value 0) |
|
| The default value for the parameter, in the binary language representation (BLR) |
|
| The default value for the parameter, in PSQL code |
|
| The identifier of the collation sequence used for a character parameter |
|
| The flag indicating whether |
|
| Flag: indicates how this parameter is passed:
|
|
| The name of the column the parameter references, if it was declared using |
|
| The name of the table the parameter references, if it was declared using |
RDB$REF_CONSTRAINTS
RDB$REF_CONSTRAINTS
stores the attributes of the referential constraints — Foreign Key relationships and referential actions.
Column Name | Data Type | Description |
---|---|---|
|
| Foreign key constraint name, defined by the user or automatically generated by the system |
|
| The name of the primary or unique key constraint linked by the |
|
| Not used. The current value is |
|
| Referential integrity actions applied to the foreign key record[s] when the primary (unique) key of the parent table is updated: |
|
| Referential integrity actions applied to the foreign key record[s] when the primary (unique) key of the parent table is deleted: |
RDB$RELATIONS
RDB$RELATIONS
stores the top-level definitions and attributes of all tables and views in the system.
Column Name | Data Type | Description |
---|---|---|
|
| Stores the query specification for a view, in the binary language representation (BLR). The field stores |
|
| Contains the original source text of the query for a view, in SQL language. User comments are included. The field stores |
|
| Could store comments related to the table or view |
|
| Internal identifier of the table or view |
|
| indicates whether the table or view is user-defined (value 0) or system-defined (value 1 or greater) |
|
| The total length of the database key. For a table: 8 bytes. For a view, the length is 8 multiplied by the number of tables referenced by the view |
|
| Internal use, points to the relation’s record in |
|
| The field ID for the next column to be added. The number is not decremented when a column is dropped. |
|
| Table or view name |
|
| May reference a security class defined in the table |
|
| The full path to the external data file if the table is defined with the |
|
| Table metadata description, used internally for optimization |
|
| Could store comments related to the external file of an external table |
|
| The user name of the user who created the table or view originally |
|
| Default security class, used when a new column is added to the table |
|
| Internal flags |
|
| The type of the relation object being described:
|
RDB$RELATION_CONSTRAINTS
RDB$RELATION_CONSTRAINTS
stores the definitions of all table-level constraints: primary, unique, foreign key, CHECK
, NOT NULL
constraints.
Column Name | Data Type | Description |
---|---|---|
|
| The name of the table-level constraint defined by the user, or otherwise automatically generated by the system |
|
| The name of the constraint type: |
|
| The name of the table this constraint applies to |
|
| Currently |
|
| Currently |
|
| The name of the index that supports this constraint. For a |
RDB$RELATION_FIELDS
RDB$RELATION_FIELDS
stores the definitions of table and view columns.
Column Name | Data Type | Description |
---|---|---|
|
| Column name |
|
| The name of the table or view that the column belongs to |
|
| Domain name on which the column is based, either a user-defined one specified in the table definition or one created automatically by the system using the set of attributes defined. The attributes are in the table |
|
| Not currently used |
|
| Only populated for a view, it is the name of the column from the base table |
|
| Not used |
|
| The zero-based ordinal position of the column in the table or view, numbering from left to right |
|
| Not used |
|
| Indicates whether the column is a regular one (value 1) or a computed one (value 0) |
|
| An ID assigned from |
|
| For a view column, the internal identifier of the base table from which this field derives |
|
| Comments related to the table or view column |
|
| The value stored for the DEFAULT clause for this column, if there is one, written in binary language representation (BLR) |
|
| Indicates whether the column is user-defined (value 0) or system-defined (value 1 or greater) |
|
| May reference a security class defined in |
|
| Not used |
|
| Indicates whether the column is nullable ( |
|
| The source text of the |
|
| The identifier of the collation sequence in the character set for the column, if it is not the default collation |
RDB$ROLES
RDB$ROLES
stores the roles that have been defined in this database.
Column Name | Data Type | Description |
---|---|---|
|
| Role name |
|
| The user name of the role owner |
|
| Could store comments related to the role |
|
| System flag |
RDB$SECURITY_CLASSES
RDB$SECURITY_CLASSES
stores the access control lists
Column Name | Data Type | Description |
---|---|---|
|
| Security class name |
|
| The access control list related to the security class. It enumerates users and their privileges |
|
| Could store comments related to the security class |
RDB$TRANSACTIONS
RDB$TRANSACTIONS
stores the states of distributed transactions and other transactions that were prepared for two-phase commit with an explicit prepare message.
Column Name | Data Type | Description |
---|---|---|
|
| The unique identifier of the transaction being tracked |
|
| Transaction state:
|
|
| Not used |
|
| Describes the prepared transaction and could be a custom message supplied to |
RDB$TRIGGERS
RDB$TRIGGERS
stores the trigger definitions for all tables and views.
Column Name | Data Type | Description |
---|---|---|
|
| Trigger name |
|
| The name of the table or view the trigger applies to. NULL if the trigger is applicable to a database event (“database trigger”) |
|
| Position of this trigger in the sequence. Zero usually means that no sequence position is specified |
|
| The event the trigger fires on:
|
Identification of the exact | ||
|
| Stores the source code of the trigger in PSQL |
|
| Stores the trigger in the binary language representation (BLR) |
|
| Trigger comment text |
|
| Indicates whether the trigger is currently inactive (1) or active (0) |
|
| Flag: indicates whether the trigger is user-defined (value 0) or system-defined (value 1 or greater) |
|
| Internal use |
|
| Indicates whether the text of the trigger remains valid after the latest modification by the the |
|
| Contains debugging information about variables used in the trigger |
RDB$TRIGGER_MESSAGES
RDB$TRIGGER_MESSAGES
stores the trigger messages.
Column Name | Data Type | Description |
---|---|---|
|
| The name of the trigger the message is associated with |
|
| The number of the message within this trigger (from 1 to 32,767) |
|
| Text of the trigger message |
RDB$TYPES
RDB$TYPES
stores the defining sets of enumerated types used throughout the system.
Column Name | Data Type | Description |
---|---|---|
|
| Enumerated type name. Each type name masters its own set of types, e.g., object types, data types, character sets, trigger types, blob subtypes, etc. |
|
| The object type identifier. A unique series of numbers is used within each separate enumerated type. For example, in this selection from the set mastered under
|
|
| The name of a member of an enumerated type, e.g., TABLE, VIEW, TRIGGER, etc. in the example above. In the |
|
| Any text comments related to the enumerated type |
|
| Flag: indicates whether the type-member is user-defined (value 0) or system-defined (value 1 or greater) |
RDB$USER_PRIVILEGES
RDB$USER_PRIVILEGES
stores the SQL access privileges for Firebird users and privileged objects.
Column Name | Data Type | Description |
---|---|---|
|
| The user or object that is granted this privilege |
|
| The user who grants the privilege |
|
| The privilege granted hereby:
|
|
| Whether the WITH GRANT OPTION authority is included with the privilege:
|
|
| The name of the object (table, view, procedure or role) the privilege is granted ON |
|
| The name of the column the privilege is applicable to, for a column-level privilege (an |
|
| Identifies the type of user the privilege is granted TO (a user, a procedure, a view, etc.) |
|
| Identifies the type of the object the privilege is granted ON |
RDB$VIEW_RELATIONS
RDB$VIEW_RELATIONS
stores the tables that are referred to in view definitions. There is one record for each table in a view.
Column Name | Data Type | Description |
---|---|---|
|
| View name |
|
| The name of the table the view references |
|
| The alias used to reference the view column in the BLR code of the query definition |
|
| The text associated with the alias reported in the |