Subject | Re: [firebird-support] Recreate indexes |
---|---|
Author | Ivan Prenosil |
Post date | 2008-07-15T18:30:30Z |
> I'm trying to build a little store procedure to rebuild my indexex wheneverActually, you do not have to set indexes to inactive to rebuild them.
> 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?
Setting them ACTIVE is enough (even if they already are active) !
Ivan