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 NameData TypeDescription

RDB$BACKUP_ID

INTEGER

The identifier assigned by the engine

RDB$TIMESTAMP

TIMESTAMP

Backup date and time

RDB$BACKUP_LEVEL

INTEGER

Backup level

RDB$GUID

CHAR(38)

Unique identifier

RDB$SCN

INTEGER

System (scan) number

RDB$FILE_NAME

VARCHAR(255)

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 NameData TypeDescription

RDB$CHARACTER_SET_NAME

CHAR(31)

Character set name

RDB$FORM_OF_USE

CHAR(31)

Not used

RDB$NUMBER_OF_CHARACTERS

INTEGER

The number of characters in the set. Not used for existing character sets

RDB$DEFAULT_COLLATE_NAME

CHAR(31)

The name of the default collation sequence for the character set

RDB$CHARACTER_SET_ID

SMALLINT

Unique character set identifier

RDB$SYSTEM_FLAG

SMALLINT

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

RDB$DESCRIPTION

BLOB TEXT

Could store text description of the character set

RDB$FUNCTION_NAME

CHAR(31)

For a user-defined character set that is accessed via an external function, the name of the external function

RDB$BYTES_PER_CHARACTER

SMALLINT

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 NameData TypeDescription

RDB$CONSTRAINT_NAME

CHAR(31)

Constraint name, defined by the user or automatically generated by the system

RDB$TRIGGER_NAME

CHAR(31)

For a CHECK constraint, it is the name of the trigger that enforces this constraint. For a NOT NULL constraint, it is the name of the table the constraint is applied to. For a foreign key constraint, it is the name of the trigger that enforces the ON UPDATE, ON DELETE clauses.

RDB$COLLATIONS

RDB$COLLATIONS stores collation sequences for all character sets.

Column NameData TypeDescription

RDB$COLLATION_NAME

CHAR(31)

Collation sequence name

RDB$COLLATION_ID

SMALLINT

Collation sequence identifier. Together with the character set identifier, it is a unique collation sequence identifier

RDB$CHARACTER_SET_ID

SMALLINT

Character set identifier. Together with the collection sequence identifier, it is a unique identifier

RDB$COLLATION_ATTRIBUTES

SMALLINT

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

RDB$SYSTEM_FLAG

SMALLINT

Flag: the value of 0 means it is user-defined; the value of 1 means it is system-defined

RDB$DESCRIPTION

BLOB TEXT

Could store text description of the collation sequence

RDB$FUNCTION_NAME

CHAR(31)

Not currently used

RDB$BASE_COLLATION_NAME

CHAR(31)

The name of the base collation sequence for this collation sequence

RDB$SPECIFIC_ATTRIBUTES

BLOB TEXT

Describes specific attributes

RDB$DATABASE

RDB$DATABASE stores basic information about the database. It contains only one record.

Column NameData TypeDescription

RDB$DESCRIPTION

BLOB TEXT

Database comment text

RDB$RELATION_ID

SMALLINT

A number that steps up by one each time a table or view is added to the database

RDB$SECURITY_CLASS

CHAR(31)

The security class defined in RDB$SECURITY_CLASSES in order to apply access control limits common to the entire database

RDB$CHARACTER_SET_NAME

CHAR(31)

The name of the default character set for the database set in the DEFAULT CHARACTER SET clause when the database is created. NULL for character set NONE.

RDB$DEPENDENCIES

RDB$DEPENDENCIES stores the dependencies between database objects.

Column NameData TypeDescription

RDB$DEPENDENT_NAME

CHAR(31)

The name of the view, procedure, trigger, CHECK constraint or computed column the dependency is defined for, i.e., the dependent object

RDB$DEPENDED_ON_NAME

CHAR(31)

The name of the object that the defined object — the table, view, procedure, trigger, CHECK constraint or computed column — depends on

RDB$FIELD_NAME

CHAR(31)

The column name in the depended-on object that is referred to by the dependent view, procedure, trigger, CHECK constraint or computed column

RDB$DEPENDENT_TYPE

SMALLINT

Identifies the type of the dependent object:

0 - table
1 - view
2 - trigger
3 - computed column
4 - CHECK constraint
5 - procedure
6 - index expression
7 - exception
8 - user
9 - column
10 - index

RDB$DEPENDED_ON_TYPE

SMALLINT

Identifies the type of the object depended on:

0 - table (or a column in it)
1 - view
2 - trigger
3 - computed column
4 - CHECK constraint
5 - procedure (or its parameter[s])
6 - index expression
7 - exception
8 - user
9 - column
10 - index
14 - generator (sequence)
15 - UDF
17 - collation

RDB$EXCEPTIONS

RDB$EXCEPTIONS stores custom database exceptions.

Column NameData TypeDescription

RDB$EXCEPTION_NAME

CHAR(31)

Custom exception name

RDB$EXCEPTION_NUMBER

INTEGER

The unique number of the exception assigned by the system

RDB$MESSAGE

VARCHAR(1021)

Exception message text

RDB$DESCRIPTION

BLOB TEXT

Could store text description of the exception

RDB$SYSTEM_FLAG

SMALLINT

Flag:

0 - user-defined
1 or higher - system-defined

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 RDB$FIELDS.RDB$FIELD_NAME links to RDB$RELATION_FIELDS.RDB$FIELD_SOURCE, not to RDB$RELATION_FIELDS.RDB$FIELD_NAME.

Column NameData TypeDescription

RDB$FIELD_NAME

CHAR(31)

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

RDB$QUERY_NAME

CHAR(31)

Not used

RDB$VALIDATION_BLR

BLOB BLR

The binary language representation (BLR) of the SQL expression specifying the check of the CHECK value in the domain

RDB$VALIDATION_SOURCE

BLOB TEXT

The original source text in the SQL language specifying the check of the CHECK value

RDB$COMPUTED_BLR

BLOB BLR

The binary language representation (BLR) of the SQL expression the database server uses for evaluation when accessing a COMPUTED BY column

RDB$COMPUTED_SOURCE

BLOB TEXT

The original source text of the expression that defines a COMPUTED BY column

RDB$DEFAULT_VALUE

BLOB BLR

The default value, if any, for the field or domain, in binary language representation (BLR)

RDB$DEFAULT_SOURCE

BLOB TEXT

The default value in the source code, as an SQL constant or expression

RDB$FIELD_LENGTH

SMALLINT

Column size in bytes. FLOAT, DATE, TIME, INTEGER occupy 4 bytes. DOUBLE PRECISION, BIGINT, TIMESTAMP and BLOB identifier occupy 8 bytes. For the CHAR and VARCHAR data types, the column stores the maximum number of bytes specified when a string domain (column) is defined

RDB$FIELD_SCALE

SMALLINT

The negative number that specifies the scale for DECIMAL and NUMERIC columns — the number of digits after the decimal point

RDB$FIELD_TYPE

SMALLINT

Data type code for the column:

7 - SMALLINT
8</code> - <code>INTEGER<br>10
- FLOAT
12 - DATE
13 - TIME
14 - CHAR
16 - BIGINT
27 - DOUBLE PRECISION
35 - TIMESTAMP
37 - VARCHAR
261 - BLOB

Codes for DECIMAL and NUMERIC are the same as for the integer types used to store them

RDB$FIELD_SUB_TYPE

SMALLINT

Specifies the subtype for the BLOB data type:

0 - untyped
1 - text
2 - BLR
3 - access control list
4 - reserved for future use
5 - encoded table metadata description
6 - for storing the details of a cross-database transaction that ends abnormally

Specifies for the CHAR data type:

0 - untyped data
1 - fixed binary data

Specifies the particular data type for the integer data types (SMALLINT, INTEGER, BIGINT) and for fixed-point numbers (NUMERIC, DECIMAL):

0 or NULL - the data type matches the value in the RDB$FIELD_TYPE field
1 - NUMERIC
2 - DECIMAL

RDB$MISSING_VALUE

BLOB BLR

Not used

RDB$MISSING_SOURCE

BLOB TEXT

Not used

RDB$DESCRIPTION

BLOB TEXT

Any domain (table column) comment text

RDB$SYSTEM_FLAG

SMALLINT

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

RDB$QUERY_HEADER

BLOB TEXT

Not used

RDB$SEGMENT_LENGTH

SMALLINT

Specifies the length of the BLOB buffer in bytes for BLOB columns. Stores NULL for all other data types

RDB$EDIT_STRING

VARCHAR(127)

Not used

RDB$EXTERNAL_LENGTH

SMALLINT

The length of the column in bytes if it belongs to an external table. Always NULL for regular tables

RDB$EXTERNAL_SCALE

SMALLINT

The scale factor of an integer-type field in an external table; represents the power of 10 by which the integer is multiplied

RDB$EXTERNAL_TYPE

SMALLINT

The data type of the field as it is represented in an external table:

7 - SMALLINT
8 - INTEGER
10 - FLOAT
12 - DATE
13 - TIME
14 - CHAR
16 - BIGINT
27 - DOUBLE PRECISION
35 - TIMESTAMP
37 - VARCHAR
261 - BLOB

RDB$DIMENSIONS

SMALLINT

Defines the number of dimensions in an array if the column is defined as an array. Always NULL for columns that are not arrays

RDB$NULL_FLAG

SMALLINT

Specifies whether the column can take an empty value (the field will contain NULL) or not (the field will contain the value of 1)

RDB$CHARACTER_LENGTH

SMALLINT

The length of CHAR or VARCHAR columns in characters (not in bytes)

RDB$COLLATION_ID

SMALLINT

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

RDB$CHARACTER_SET_ID

SMALLINT

The identifier of the character set for a character column, BLOB TEXT column or domain

RDB$FIELD_PRECISION

SMALLINT

Specifies the total number of digits for the fixed-point numeric data type (DECIMAL and NUMERIC). The value is 0 for the integer data types, NULL is for other data types

RDB$FIELD_DIMENSIONS

RDB$FIELD_DIMENSIONS stores the dimensions of array columns.

Column NameData TypeDescription

RDB$FIELD_NAME

CHAR(31)

The name of the array column. It must be present in the RDB$FIELD_NAME field of the RDB$FIELDS table

RDB$DIMENSION

SMALLINT

Identifies one dimension in the array column. The numbering of dimensions starts with 0

RDB$LOWER_BOUND

INTEGER

The lower bound of this dimension

RDB$UPPER_BOUND

INTEGER

The upper bound of this dimension

RDB$FILES

RDB$FILES stores information about secondary files and shadow files.

Column NameData TypeDescription

RDB$FILE_NAME

VARCHAR(255)

The full path to the file and the name of either

  • the database secondary file in a multi-file database, or

  • the shadow file

RDB$FILE_SEQUENCE

SMALLINT

The sequential number of the secondary file in a sequence or of the shadow file in a shadow file set

RDB$FILE_START

INTEGER

The initial page number in the secondary file or shadow file

RDB$FILE_LENGTH

INTEGER

File length in database pages

RDB$FILE_FLAGS

SMALLINT

For internal use

RDB$SHADOW_NUMBER

SMALLINT

Shadow set number. If the row describes a database secondary file, the field will be NULL or its value will be 0

RDB$FILTERS

RDB$FILTERS stores information about BLOB filters.

Column NameData TypeDescription

RDB$FUNCTION_NAME

CHAR(31)

The unique identifier of the BLOB filter

RDB$DESCRIPTION

BLOB TEXT

Documentation about the BLOB filter and the two subtypes it is used with, written by the user

RDB$MODULE_NAME

VARCHAR(255)

The name of the dynamic library or shared object where the code of the BLOB filter is located

RDB$ENTRYPOINT

CHAR(31)

The exported name of the BLOB filter in the filter library. Note, this is often not the same as RDB$FUNCTION_NAME, which is the identifier with which the BLOB filter is declared to the database

RDB$INPUT_SUB_TYPE

SMALLINT

The BLOB subtype of the data to be converted by the function

RDB$OUTPUT_SUB_TYPE

SMALLINT

The BLOB subtype of the converted data

RDB$SYSTEM_FLAG

SMALLINT

Flag indicating whether the filter is user-defined or internally defined:

0 - user-defined
1 or greater - 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 NameData TypeDescription

RDB$RELATION_ID

SMALLINT

Table or view identifier

RDB$FORMAT

SMALLINT

Table format identifier — maximum 255. The critical time comes when this number approaches 255 for any table or view

RDB$DESCRIPTOR

BLOB FORMAT

Stores column names and data attributes as BLOB, as they were at the time the format record was created

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+) RDB$FUNCTIONS will also store the information about stored functions: user-defined functions written in PSQL.

Column NameData TypeDescription

RDB$FUNCTION_NAME

CHAR(31)

The unique (declared) name of the external function

RDB$FUNCTION_TYPE

SMALLINT

Not currently used

RDB$QUERY_NAME

CHAR(31)

Not currently used

RDB$DESCRIPTION

BLOB TEXT

Any text with comments related to the external function

RDB$MODULE_NAME

VARCHAR(255)

The name of the dynamic library or shared object where the code of the external function is located

RDB$ENTRYPOINT

CHAR(31)

The exported name of the external function in the function library. Note, this is often not the same as RDB$FUNCTION_NAME, which is the identifier with which the external function is declared to the database

RDB$RETURN_ARGUMENT

SMALLINT

The position number of the returned argument in the list of parameters corresponding to input arguments

RDB$SYSTEM_FLAG

SMALLINT

Flag indicating whether the filter is user-defined or internally defined:

0 - user-defined
1 - internally defined

RDB$FUNCTION_ARGUMENTS

RDB$FUNCTION_ARGUMENTS stores the parameters of external functions and their attributes.

Column NameData TypeDescription

RDB$FUNCTION_NAME

CHAR(31)

The unique name (declared identifier) of the external function

RDB$ARGUMENT_POSITION

SMALLINT

The position of the argument in the list of arguments

RDB$MECHANISM

SMALLINT

Flag: how this argument is passed:

0 - by value
1 - by reference
2 - by descriptor
3 - by BLOB descriptor

RDB$FIELD_TYPE

SMALLINT

Data type code defined for the column:

7 - SMALLINT
8 - INTEGER
12 - DATE
13 - TIME
14 - CHAR
16 - BIGINT
27 - DOUBLE PRECISION
35 - TIMESTAMP
37 - VARCHAR
40 - CSTRING (null-terminated text)
45 - BLOB_ID
261 - BLOB

RDB$FIELD_SCALE

SMALLINT

The scale of an integer or a fixed-point argument. It is an exponent of 10

RDB$FIELD_LENGTH

SMALLINT

Argument length in bytes:

SMALLINT = 2
INTEGER = 4
DATE = 4
TIME = 4
BIGINT = 8
DOUBLE PRECISION = 8
TIMESTAMP = 8
BLOB_ID = 8

RDB$FIELD_SUB_TYPE

SMALLINT

Stores the BLOB subtype for an argument of a BLOB data type

RDB$CHARACTER_SET_ID

SMALLINT

The identifier of the character set for a character argument

RDB$FIELD_PRECISION

SMALLINT

The number of digits of precision available for the data type of the argument

RDB$CHARACTER_LENGTH

SMALLINT

The length of a CHAR or VARCHAR argument in characters (not in bytes)

RDB$GENERATORS

RDB$GENERATORS stores generators (sequences) and keeps them up-to-date.

Column NameData TypeDescription

RDB$GENERATOR_NAME

CHAR(31)

The unique name of the generator

RDB$GENERATOR_ID

SMALLINT

The unique identifier assigned to the generator by the system

RDB$SYSTEM_FLAG

SMALLINT

Flag:

0 - user-defined
1 or greater - system-defined

RDB$DESCRIPTION

BLOB TEXT

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 NameData TypeDescription

RDB$INDEX_NAME

CHAR(31)

The unique name of the index specified by the user or automatically generated by the system

RDB$RELATION_NAME

CHAR(31)

The name of the table to which the index belongs. It corresponds to an identifier in RDB$RELATION_NAME.RDB$RELATIONS

RDB$INDEX_ID

SMALLINT

The internal (system) identifier of the index

RDB$UNIQUE_FLAG

SMALLINT

Specifies whether the index is unique:

0 - not unique
1 - unique

RDB$DESCRIPTION

BLOB TEXT

Could store comments concerning the index

RDB$SEGMENT_COUNT

SMALLINT

The number of segments (columns) in the index

RDB$INDEX_INACTIVE

SMALLINT

Indicates whether the index is currently active:

0 - active
1 - inactive

RDB$INDEX_TYPE

SMALLINT

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

RDB$FOREIGN_KEY

CHAR(31)

The name of the associated Foreign Key constraint, if any

RDB$SYSTEM_FLAG

SMALLINT

Indicates whether the index is system-defined or user-defined:

0 - user-defined
1 or greater - system-defined

RDB$EXPRESSION_BLR

BLOB BLR

Expression for an expression index, written in the binary language representation (BLR), used for calculating the values for the index at runtime.

RDB$EXPRESSION_SOURCE

BLOB TEXT

The source code of the expression for an expression index

RDB$STATISTICS

DOUBLE PRECISION

Stores the last known selectivity of the entire index, calculated by execution of a SET STATISTICS statement over the index. It is also recalculated whenever the database is first opened by the server. The selectivity of each separate segment of the index is stored in RDB$INDEX_SEGMENTS.

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 NameData TypeDescription

RDB$INDEX_NAME

CHAR(31)

The name of the index this segment is related to. The master record is RDB$INDICES.RDB$INDEX_NAME.

RDB$FIELD_NAME

CHAR(31)

The name of a column belonging to the index, corresponding to an identifier for the table and that column in RDB$RELATION_FIELDS.RDB$FIELD_NAME

RDB$FIELD_POSITION

SMALLINT

The column position in the index. Positions are numbered left-to-right, starting at zero

RDB$STATISTICS

DOUBLE PRECISION

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 NameData TypeDescription

RDB$PAGE_NUMBER

INTEGER

The unique number of a physically created database page

RDB$RELATION_ID

SMALLINT

The identifier of the table to which the page is allocated

RDB$PAGE_SEQUENCE

INTEGER

The number of the page in the sequence of all pages allocated to this table

RDB$PAGE_TYPE

SMALLINT

Indicates the page type (data, index, BLOB, etc.). For system use

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 NameData TypeDescription

RDB$PROCEDURE_NAME

CHAR(31)

Stored procedure name (identifier)

RDB$PROCEDURE_ID

SMALLINT

The procedure’s unique, system-generated identifier

RDB$PROCEDURE_INPUTS

SMALLINT

Indicates the number of input parameters. NULL if there are none

RDB$PROCEDURE_OUTPUTS

SMALLINT

Indicates the number of output parameters. NULL if there are none

RDB$DESCRIPTION

BLOB TEXT

Any text comments related to the procedure

RDB$PROCEDURE_SOURCE

BLOB TEXT

The PSQL source code of the procedure

RDB$PROCEDURE_BLR

BLOB BLR

The binary language representation (BLR) of the procedure code

RDB$SECURITY_CLASS

CHAR(31)

May point to the security class defined in the system table RDB$SECURITY_CLASSES in order to apply access control limits

RDB$OWNER_NAME

CHAR(31)

The user name of the procedure’s Owner — the user who was CURRENT_USER when the procedure was first created. It may or may not be the user name of the author

RDB$RUNTIME

BLOB

A metadata description of the procedure, used internally for optimization

RDB$SYSTEM_FLAG

SMALLINT

Indicates whether the procedure is defined by a user (value 0) or by the system (a value of 1 or greater)

RDB$PROCEDURE_TYPE

SMALLINT

Procedure type:

1 - selectable stored procedure (contains a SUSPEND statement)
2 - executable stored procedure
NULL - not known

for procedures created before Firebird 1.5

RDB$VALID_BLR

SMALLINT

Indicates whether the source PSQL of the stored procedure remains valid after the latest ALTER PROCEDURE modification

RDB$DEBUG_INFO

BLOB

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 NameData TypeDescription

RDB$PARAMETER_NAME

CHAR(31)

Parameter name

RDB$PROCEDURE_NAME

CHAR(31)

The name of the procedure where the parameter is defined

RDB$PARAMETER_NUMBER

SMALLINT

The sequential number of the parameter

RDB$PARAMETER_TYPE

SMALLINT

Indicates whether the parameter is for input (value 0) or output (value 1)

RDB$FIELD_SOURCE

CHAR(31)

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.

RDB$DESCRIPTION

BLOB TEXT

Could store comments related to the parameter

RDB$SYSTEM_FLAG

SMALLINT

Indicates whether the parameter was defined by the system (value or greater) or by a user (value 0)

RDB$DEFAULT_VALUE

BLOB BLR

The default value for the parameter, in the binary language representation (BLR)

RDB$DEFAULT_SOURCE

BLOB TEXT

The default value for the parameter, in PSQL code

RDB$COLLATION_ID

SMALLINT

The identifier of the collation sequence used for a character parameter

RDB$NULL_FLAG

SMALLINT

The flag indicating whether NULL is allowable

RDB$PARAMETER_MECHANISM

SMALLINT

Flag: indicates how this parameter is passed:

0 - by value
1 - by reference
2 - by descriptor
3 - by BLOB descriptor

RDB$FIELD_NAME

CHAR(31)

The name of the column the parameter references, if it was declared using TYPE OF COLUMN instead of a regular data type. Used in conjunction with RDB$RELATION_NAME (see next).

RDB$RELATION_NAME

CHAR(31)

The name of the table the parameter references, if it was declared using TYPE OF COLUMN instead of a regular data type

RDB$REF_CONSTRAINTS

RDB$REF_CONSTRAINTS stores the attributes of the referential constraints — Foreign Key relationships and referential actions.

Column NameData TypeDescription

RDB$CONSTRAINT_NAME

CHAR(31)

Foreign key constraint name, defined by the user or automatically generated by the system

RDB$CONST_NAME_UQ

CHAR(31)

The name of the primary or unique key constraint linked by the REFERENCES clause in the constraint definition

RDB$MATCH_OPTION

CHAR(7)

Not used. The current value is FULL in all cases

RDB$UPDATE_RULE

CHAR(11)

Referential integrity actions applied to the foreign key record[s] when the primary (unique) key of the parent table is updated: RESTRICT, NO ACTION, CASCADE, SET NULL, SET DEFAULT

RDB$DELETE_RULE

CHAR(11)

Referential integrity actions applied to the foreign key record[s] when the primary (unique) key of the parent table is deleted: RESTRICT, NO ACTION, CASCADE, SET NULL, SET DEFAULT

RDB$RELATIONS

RDB$RELATIONS stores the top-level definitions and attributes of all tables and views in the system.

Column NameData TypeDescription

RDB$VIEW_BLR

BLOB BLR

Stores the query specification for a view, in the binary language representation (BLR). The field stores NULL for a table

RDB$VIEW_SOURCE

BLOB TEXT

Contains the original source text of the query for a view, in SQL language. User comments are included. The field stores NULL for a table

RDB$DESCRIPTION

BLOB TEXT

Could store comments related to the table or view

RDB$RELATION_ID

SMALLINT

Internal identifier of the table or view

RDB$SYSTEM_FLAG

SMALLINT

indicates whether the table or view is user-defined (value 0) or system-defined (value 1 or greater)

RDB$DBKEY_LENGTH

SMALLINT

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

RDB$FORMAT

SMALLINT

Internal use, points to the relation’s record in RDB$FORMATS — do not modify

RDB$FIELD_ID

SMALLINT

The field ID for the next column to be added. The number is not decremented when a column is dropped.

RDB$RELATION_NAME

CHAR(31)

Table or view name

RDB$SECURITY_CLASS

CHAR(31)

May reference a security class defined in the table RDB$SECURITY_CLASSES, in order to apply access control limits to all users of this table or view

RDB$EXTERNAL_FILE

VARCHAR(255)

The full path to the external data file if the table is defined with the EXTERNAL FILE clause

RDB$RUNTIME

BLOB

Table metadata description, used internally for optimization

RDB$EXTERNAL_DESCRIPTION

BLOB

Could store comments related to the external file of an external table

RDB$OWNER_NAME

CHAR(31)

The user name of the user who created the table or view originally

RDB$DEFAULT_CLASS

CHAR(31)

Default security class, used when a new column is added to the table

RDB$FLAGS

SMALLINT

Internal flags

RDB$RELATION_TYPE

SMALLINT

The type of the relation object being described:

0 - system or user-defined table
1 - view
2 - external table
3 - monitoring table
4 - connection-level GTT (PRESERVE ROWS)
5 - transaction-level GTT (DELETE ROWS)

RDB$RELATION_CONSTRAINTS

RDB$RELATION_CONSTRAINTS stores the definitions of all table-level constraints: primary, unique, foreign key, CHECK, NOT NULL constraints.

Column NameData TypeDescription

RDB$CONSTRAINT_NAME

CHAR(31)

The name of the table-level constraint defined by the user, or otherwise automatically generated by the system

RDB$CONSTRAINT_TYPE

CHAR(11)

The name of the constraint type: PRIMARY KEY, UNIQUE, FOREIGN KEY, CHECK or NOT NULL

RDB$RELATION_NAME

CHAR(31)

The name of the table this constraint applies to

RDB$DEFERRABLE

CHAR(3)

Currently NO in all cases: Firebird does not yet support deferrable constraints

RDB$INITIALLY_DEFERRED

CHAR(3)

Currently NO in all cases

RDB$INDEX_NAME

CHAR(31)

The name of the index that supports this constraint. For a CHECK or a NOT NULL constraint, it is NULL.

RDB$RELATION_FIELDS

RDB$RELATION_FIELDS stores the definitions of table and view columns.

Column NameData TypeDescription

RDB$FIELD_NAME

CHAR(31)

Column name

RDB$RELATION_NAME

CHAR(31)

The name of the table or view that the column belongs to

RDB$FIELD_SOURCE

CHAR(31)

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 RDB$FIELDS: this column matches RDB$FIELDS.RDB$FIELD_NAME.

RDB$QUERY_NAME

CHAR(31)

Not currently used

RDB$BASE_FIELD

CHAR(31)

Only populated for a view, it is the name of the column from the base table

RDB$EDIT_STRING

VARCHAR(127)

Not used

RDB$FIELD_POSITION

SMALLINT

The zero-based ordinal position of the column in the table or view, numbering from left to right

RDB$QUERY_HEADER

BLOB TEXT

Not used

RDB$UPDATE_FLAG

SMALLINT

Indicates whether the column is a regular one (value 1) or a computed one (value 0)

RDB$FIELD_ID

SMALLINT

An ID assigned from RDB$RELATIONS.RDB$FIELD_ID at the time the column was added to the table or view. It should always be treated as transient

RDB$VIEW_CONTEXT

SMALLINT

For a view column, the internal identifier of the base table from which this field derives

RDB$DESCRIPTION

BLOB TEXT

Comments related to the table or view column

RDB$DEFAULT_VALUE

BLOB BLR

The value stored for the DEFAULT clause for this column, if there is one, written in binary language representation (BLR)

RDB$SYSTEM_FLAG

SMALLINT

Indicates whether the column is user-defined (value 0) or system-defined (value 1 or greater)

RDB$SECURITY_CLASS

CHAR(31)

May reference a security class defined in RDB$SECURITY_CLASSES, in order to apply access control limits to all users of this column

RDB$COMPLEX_NAME

CHAR(31)

Not used

RDB$NULL_FLAG

SMALLINT

Indicates whether the column is nullable (NULL) non-nullable (value 1)

RDB$DEFAULT_SOURCE

BLOB TEXT

The source text of the DEFAULT clause, if any

RDB$COLLATION_ID

SMALLINT

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 NameData TypeDescription

RDB$ROLE_NAME

CHAR(31)

Role name

RDB$OWNER_NAME

CHAR(31)

The user name of the role owner

RDB$DESCRIPTION

BLOB TEXT

Could store comments related to the role

RDB$SYSTEM_FLAG

SMALLINT

System flag

RDB$SECURITY_CLASSES

RDB$SECURITY_CLASSES stores the access control lists

Column NameData TypeDescription

RDB$SECURITY_CLASS

CHAR(31)

Security class name

RDB$ACL

BLOB ACL

The access control list related to the security class. It enumerates users and their privileges

RDB$DESCRIPTION

BLOB TEXT

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 NameData TypeDescription

RDB$TRANSACTION_ID

INTEGER

The unique identifier of the transaction being tracked

RDB$TRANSACTION_STATE

SMALLINT

Transaction state:

0 - in limbo
1 - committed
2 - rolled back

RDB$TIMESTAMP

TIMESTAMP

Not used

RDB$TRANSACTION_DESCRIPTION

BLOB

Describes the prepared transaction and could be a custom message supplied to isc_prepare_transaction2, even if it is not a distributed transaction. It may be used when a lost connection cannot be restored

RDB$TRIGGERS

RDB$TRIGGERS stores the trigger definitions for all tables and views.

Column NameData TypeDescription

RDB$TRIGGER_NAME

CHAR(31)

Trigger name

RDB$RELATION_NAME

CHAR(31)

The name of the table or view the trigger applies to. NULL if the trigger is applicable to a database event (“database trigger”)

RDB$TRIGGER_SEQUENCE

SMALLINT

Position of this trigger in the sequence. Zero usually means that no sequence position is specified

RDB$TRIGGER_TYPE

SMALLINT

The event the trigger fires on:

1 - before insert
2 - after insert
3 - before update
4 - after update
5 - before delete
6 - after delete
17 - before insert or update
18 - after insert or update
25 - before insert or delete
26 - after insert or delete
27 - before update or delete
28 - after update or delete
113 - before insert or update or delete
114 - after insert or update or delete
8192 - on connect
8193 - on disconnect
8194 - on transaction start
8195 - on transaction commit
8196 - on transaction rollback

Identification of the exact RDB$TRIGGER_TYPE code is a little more complicated, since it is a bitmap, calculated according to which phase and events are covered and the order in which they are defined. For the curious, the calculation is explained in this code comment by Mark Rotteveel.

RDB$TRIGGER_SOURCE

BLOB TEXT

Stores the source code of the trigger in PSQL

RDB$TRIGGER_BLR

BLOB BLR

Stores the trigger in the binary language representation (BLR)

RDB$DESCRIPTION

BLOB TEXT

Trigger comment text

RDB$TRIGGER_INACTIVE

SMALLINT

Indicates whether the trigger is currently inactive (1) or active (0)

RDB$SYSTEM_FLAG

SMALLINT

Flag: indicates whether the trigger is user-defined (value 0) or system-defined (value 1 or greater)

RDB$FLAGS

SMALLINT

Internal use

RDB$VALID_BLR

SMALLINT

Indicates whether the text of the trigger remains valid after the latest modification by the the ALTER TRIGGER statement

RDB$DEBUG_INFO

BLOB

Contains debugging information about variables used in the trigger

RDB$TRIGGER_MESSAGES

RDB$TRIGGER_MESSAGES stores the trigger messages.

Column NameData TypeDescription

RDB$TRIGGER_NAME

CHAR(31)

The name of the trigger the message is associated with

RDB$MESSAGE_NUMBER

SMALLINT

The number of the message within this trigger (from 1 to 32,767)

RDB$MESSAGE

VARCHAR(1023)

Text of the trigger message

RDB$TYPES

RDB$TYPES stores the defining sets of enumerated types used throughout the system.

Column NameData TypeDescription

RDB$FIELD_NAME

CHAR(31)

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.

RDB$TYPE

SMALLINT

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 RDB$OBJECT_TYPE in RDB$FIELD_NAME, some object types are enumerated:

0 - TABLE
1 - VIEW
2 - TRIGGER
3 - COMPUTED_FIELD
4 - VALIDATION
5 - PROCEDURE
 …​

RDB$TYPE_NAME

CHAR(31)

The name of a member of an enumerated type, e.g., TABLE, VIEW, TRIGGER, etc. in the example above. In the RDB$CHARACTER_SET enumerated type, RDB$TYPE_NAME stores the names of the character sets.

RDB$DESCRIPTION

BLOB TEXT

Any text comments related to the enumerated type

RDB$SYSTEM_FLAG

SMALLINT

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 NameData TypeDescription

RDB$USER

CHAR(31)

The user or object that is granted this privilege

RDB$GRANTOR

CHAR(31)

The user who grants the privilege

RDB$PRIVILEGE

CHAR(6)

The privilege granted hereby:

A - all (all privileges)
S - select (selecting data)
I - insert (inserting rows)
D - delete (deleting rows)
R - references (foreign key)
U - update (updating data)
X - executing (procedure)

RDB$GRANT_OPTION

SMALLINT

Whether the WITH GRANT OPTION authority is included with the privilege:

0 - not included
1 - included

RDB$RELATION_NAME

CHAR(31)

The name of the object (table, view, procedure or role) the privilege is granted ON

RDB$FIELD_NAME

CHAR(31)

The name of the column the privilege is applicable to, for a column-level privilege (an UPDATE or REFERENCES privilege)

RDB$USER_TYPE

SMALLINT

Identifies the type of user the privilege is granted TO (a user, a procedure, a view, etc.)

RDB$OBJECT_TYPE

SMALLINT

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 NameData TypeDescription

RDB$VIEW_NAME

CHAR(31)

View name

RDB$RELATION_NAME

CHAR(31)

The name of the table the view references

RDB$VIEW_CONTEXT

SMALLINT

The alias used to reference the view column in the BLR code of the query definition

RDB$CONTEXT_NAME

CHAR(255)

The text associated with the alias reported in the RDB$VIEW_CONTEXT column