Firebird System Queries for Retrieving Database Object Information
Firebird databases contain system tables that store meta data on objects such as tables, views, indexes, procedures, functions, and triggers. These system tables are prefixed with the RDB$ prefix. Below are example queries for retrieving object meta data for Firebird databases.
Tables
The query below will return information about all non-system tables in a Firebird database.
select * from RDB$RELATIONS where RDB$RELATION_TYPE = 0 and RDB$SYSTEM_FLAG = 0;
Views
The query below will return information about non-system views defined in a Firebird database.
select * from RDB$RELATIONS where RDB$RELATION_TYPE = 1 and RDB$SYSTEM_FLAG = 0;
Indexes
The query below will return information about non-system indexes defined in a Firebird database.
select * from RDB$INDICES where RDB$SYSTEM_FLAG = 0;
Triggers
The query below will return information about triggers defined in a Firebird database.
select * from RDB$TRIGGERS where RDB$SYSTEM_FLAG = 0;
Procedures
The first query below will return information about procedures defined in a Firebird database. The second query will return parameter information for the procedure named GET_EMP_PROJ.
select * from RDB$PROCEDURES where RDB$SYSTEM_FLAG = 0;
select * from RDB$PROCEDURE_PARAMETERS where RDB$PROCEDURE_NAME = 'GET_EMP_PROJ';
Functions
The first query below will return information about functions defined in a Firebird database. The second query will return parameter information for the function named GET_SALARY.
select * from RDB$FUNCTIONS where RDB$SYSTEM_FLAG = 0;
select * from RDB$FUNCTION_ARGUMENTS where RDB$FUNCTION_NAME = 'GET_SALARY';
Listed below are links to articles containing system queries for other databases:
Cassandra: Cassandra System Queries
Microsoft SQL Server: SQL Server System Queries
MySQL: MySQL System Queries
Oracle: Oracle System Queries
PostgreSQL: PostgreSQL System Queries
SQLite: SQLite System Queries
Sybase: Sybase System Queries