5. Database tools
5.1 Find in metadata
Database > Find in metadata... (Ctrl+Shift+M) searches object names and, optionally, the source of procedures, functions, triggers and views. Each hit shows the object, the table, the line and the text; double-click or Open object opens the editor.

Find in metadata
5.2 ER diagram
Database > ER diagram draws the tables of the database with fields, keys and foreign-key relationships. Drag tables to arrange them, zoom with the mouse wheel, search a table, toggle relationships, fit the view and export the diagram as SVG. Regenerate reloads it after schema changes; Close or Esc closes the window.

ER diagram
5.3 Compare databases
Database > Compare databases... compares the metadata of a source (reference) database with a target and generates the script that brings the target in line with the source. Use <-> to swap them.

Comparison: differences
Differences tab
- A tree with a Summary and groups by object type (procedures, functions, triggers, views, tables, constraints, indexes, domains, ...). Colours and icons show the kind of difference: NEW (missing in target), CHANGED, ONLY IN TARGET, TEXT ONLY (formatting or comments only) and objects recompiled because of a dependency.
- A filter by difference type and by name.
- For the selected object: source on the left and target on the right, with aligned lines, synchronised scrolling and highlighted changes. Previous/Next difference (F3 / Shift+F3) and Ignore spaces and case.
- The SQL generated for that object.
Progress tab shows the comparison log, the warnings and the options:
| Option | Effect |
|---|---|
| Include DROP | Drops objects that exist only in the target |
| Neutralize dependencies | Empties dependent PSQL bodies before altering an object and restores them afterwards |
| Comments | Includes object descriptions |
| Privileges | Includes grants |
| Match constraints by definition | Treats constraints with different names but the same definition as equal |
| Exclude IBE$ | Ignores IBExpert service tables |

Comparison: progress
Script tab: the complete migration script, organised in phases in dependency order. Save..., Copy, Open in SQL editor or Run on target... (through the script runner).

Comparison: script
The comparer understands current PSQL syntax, handles table/view name conflicts, legacy UDFs, character sets and computes view dependencies from the source when the catalog is incomplete. Always review the script and back up the target before running it.
5.4 Extract metadata
Database > Extract metadata (DDL script)... produces the complete DDL of a database (domains, tables, constraints, views, procedures, triggers, ...) in dependency order, ready to create an empty copy.

Extract metadata
5.5 PSQL debugger
Select a procedure, function or trigger and choose Database > Debug selected routine (PSQL)....

PSQL debugger
- Step into, Step over, Step out, Run, Stop.
- Click the gutter to toggle a breakpoint; the current line is highlighted.
- Variables: input, output, local and context variables (
ROW_COUNT,SQLCODE,GDSCODE) with their current values. Double-click an input parameter to set its value before running. - Stack, Output (SUSPEND) for rows returned by selectable procedures, and Log SQL with the statements executed.
- The debug session runs in its own transaction: Commit or Rollback at the end (closing the tab asks which one).
5.6 Monitor
Database > Monitor... shows the monitoring tables (Firebird 2.1+): Attachments, Transactions, Running statements and Database. Refresh or Every 5 s updates the view; Disconnect... closes another attachment and Cancel statements... stops its running statements.

Monitor
5.7 Database properties
Database > Database properties... changes the main database settings through the configuration service (like gfix): sweep interval, page buffers, forced writes, reserve space, read only and SQL dialect. Read only and dialect require that no other attachment is open.

Database properties
5.8 Legacy UDFs
Database > Legacy UDFs... lists external functions declared with DECLARE EXTERNAL FUNCTION, with module, entry point, the objects that use them and whether the name shadows a built-in function (for example ABS, LOWER). Replace with built-in and Replace all generate a script that switches the dependent objects to the internal functions and drops the UDF; Drop removes unused UDFs; Copy DDL copies the declaration. This helps migrating old databases to Firebird 4/5, where UDFs are deprecated.

Legacy UDFs
5.9 Script runner
SQL > Run script on a database... runs a long script on a chosen target with a full log of every statement. Stop on first error interrupts at the first failure; Open... loads a script file, Save log... saves the log. SmartFBX asks for confirmation showing the target database before running.

Script runner