Subject Re: [firebird-support] Re: Schema query? Need help to get started.
Author Martijn Tonies
Hi,

> > My main problem is:
> >
> > * Lack of documentation. For a lof of the sutff I am pretty lost.
>
> Borland open sourced Interbase and Firebird is based on that open
> source build. I doubt Borland bothered to publish an exhaustive list
> of every system table and field, so feel free to document anything you
> find and contribute it. The documentation will come eventually, but at
> the moment it is pretty high level.

The InterBase documentation has a chapter on "system tables and
views".

> > * Where the heck is a list of all TABLES? I can find fields, relations,
> > but no RDB$ table that contains the TABLES themseves.
>
> The RDB$ isn't simply a convenience for people such as yourself, you
> will not find a hidden table called RDB$GET_THE_TABLE_NAMES.
>
> In two minutes I wrote this
>
> SELECT RDB$RELATION_NAME
> FROM RDB$RELATIONS
> WHERE RDB$RELATION_NAME NOT LIKE 'RDB$%'
> AND RDB$RELATION_NAME NOT IN
> (
> SELECT RDB$VIEW_NAME
> FROM RDB$VIEW_RELATIONS
> )
> ORDER BY RDB$RELATION_NAME
>
> It wasn't rocket science (and there may be a better way to do it), I
> simply noticed that the RDB$RELATIONS.RDB$RELATION_NAME was pretty
> close, it just also included the views and the system tables.

Even easier:

select * from rdb$relations
where rdb$view_blr is null // filters views
and rdb$system_flag is null or rdb$system_flag = 0 // filters system tables

With regards,

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com