Subject Re: [firebird-support] Re: Schema query? Need help to get started.
Author Ann W. Harrison
Adam wrote:
>
>
> 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
>

The official way of doing this is

select RDB$RELATION_NAME from RDB$RELATIONS
where RDB$VIEW_BLR is null
and (RDB$SYSTEM_FLAG = 0 or RDB$SYSTEM_FLAG is null)
order by RDB$RELATION_NAME

The reason for using the RDB$SYSTEM_FLAG is that you can have user
tables that start with RDB$. Only the system can set the RDB$SYSTEM_FLAG.

Without a view definition (RDB$VIEW_BLR) the relation can't be a view
and therefore must be a base table.

Regards,


Ann