Subject RE: [ib-support] Extracting Table Creation declarations
Author Martijn Tonies

well, if you don't care using 3rd party (non-free) tools, you might want
to take a look at InterBase Workbench - as other tools, it has a
recorder' with which you can record your DDL changes.

As for a meta data extract, the IB/FB metadata tables are quite a

Sometimes IB itself doesn't know what to show (especially for IB 5.x,
is a bit better).

Then, there's the issue with, for example, triggers - they can be found
in the RDB$TRIGGERS table. But some triggers are system defined to take
care of foreign key references, check constraints and more... Claudio
changed a couple of things for FB1 so that it's easier to recognize
defined triggers, but this will only work if you're creating your DB
scratch with FB1...

Take a look at the Language Reference, chapter SYSTEM TABLES AND VIEWS.
And learn to look through the documentation errors...

RDB$RELATIONS == lists tables and views
RDB$RELATION_FIELDS== lists the columns for a table or view and the
(domain) source
RDB$FIELDS == lists the domains, either user defined or system
RDB$GENERATORS == lists all generators
RDB$TRIGGERS == lists triggers
RDB$INDICES == lists indices
RDB$INDEX_SEGMENTS == lists indexed columns
RDB$RELATION_CONSTRAINTS == lists basic constraint info, together with
several other tables (RDB$CHECK_CONSTRAINTS for example) it lists the
full constraint info. For PKs, use RDB$INDEX_SEGMENTS to get what fields

are constrained. For FKs, use RDB$REF_CONSTRAINTS to know to what
constraint the FK is pointing, then, use the RDB$INDEX_SEGMENTS and
RDB$CONSTRAINTS table to get what fields are in use by that constraint.

And there are several more...

Good luck :)

Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird

In fact , what i'm trying to do is life easier.
Seriusly , to mantain consistency between the central (development)
and the installed (production) ones , so if I alter tables in the
development database , I could do a comparation between ddl's of both
databases online and make some sort of operation that mantains
betewen the client software and the database. Is far more complicated
this , of course , but you could see the general idea. A sort of "poor
database replication"

And i really appreciate to know what's going on , so a component that
without the source code to poke arround , since it could be really
(i'm taking a deep interest in IBO , but I'm open to suggestions , of
course) , is not what i really like.

Thanks for your interest.

EntreBytes S.L.
Ontenient , Spain
ERP Development.

To: <>
Sent: Wednesday, April 03, 2002 1:43 PM
Subject: RE: [ib-support] Extracting Table Creation declarations

> Hi,
> Almost all system tables :)
> It's not as easy at it looks... You might want to use one of the
> ready-made solutions. Both IBExpress and IBObjects have a meta data
> extract component, I guess FIBPlus has one too.
> What are you trying to do, perhaps there's another way?
> Martijn Tonies
> InterBase Workbench - the developer tool for InterBase and Firebird
> Could someone tell me what system table i should query to ascern
> the code for creation of the user tables ? Sort of a extract database
> isql , but by delphi code / sql query.
> Javi
> EntreBytes S.L.
> Ontenient , Spain
> ERP Development.