Subject Re: [firebird-support] Recreate indexes
Author Thomas Steinmaurer
Hi Fabio,

> I'm trying to build a little store procedure to rebuild my indexex whenever
> I want...
>
> her3e you are:
>
> for select 'ALTER INDEX '||rdb$index_name ||' INACTIVE;'
> from rdb$indices
> where rdb$system_flag is null or rdb$system_flag = 0
> into :COMANDO
> do EXECUTE STATEMENT :COMANDO;
>
> /* ACTIVE Indici */
> for select 'ALTER INDEX '||rdb$index_name ||' ACTIVE;'
> from rdb$indices
> where rdb$system_flag is null or rdb$system_flag = 0
> into :COMANDO
> do EXECUTE STATEMENT :COMANDO;
>
> I suppose to identify no SYSTEM index using rdb$system_flag is null or
> rdb$system_flag = 0
> but if I run it I obtain an error who tell me:
>
> This operation is not defined for system tables.
> unsuccessful metadata update.
> MODIFY RDB$INDICES failed.
> action cancelled by trigger (3) to preserve data integrity.
> Cannot deactivate index used by a PRIMARY/UNIQUE constraint.
>
> soem idea?

You can't deactivate the underlaying index of a primary / unique constraint.


--
Best Regards,
Thomas Steinmaurer
LogManager Series - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database, MS SQL Server and
NexusDB V2
Upscene Productions
http://www.upscene.com