Subject Re: [firebird-support] Distinguishing user-defined indexes
Author Martijn Tonies
> >> select
> >> *
> >> from
> >> rdb$indices i
> >> where
> >> (i.rdb$system_flag = 0 or i.rdb$system_flag is null)
> >> and not exists (select 1 from rdb$relation_constraints r where
> >> r.rdb$index_name = i.rdb$index_name)
>
> M> Exactly. This filters indices not created by constraints. Easy :-)
>
> ...once you know it. :-)
> Didn't bother to have a look at RDB$RELATION_CONSTRAINTS to see if the
> index name was recorded there... Thanks a lot Thomas (and Martijn).

Well, obvisously ;-)

Given that PKs, Unique Constraints and FKs create indices and have different
fields (index_segments), you need the RDB$INDICES table to know where
to get PK fields, for example.

With regards,

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