Subject Re: [firebird-support] Cannot restore a database because of failed unique key index
Author Thomas Steinmaurer
> We use Firebird 2.5.1 on Linux 64 bit
>
> Firebird fails to restore because of a unique constraint( see below ).
> However when interrogating the data, no duplicate is found. ( see below SQL, unique key is on the grouped by fields )
>
> How can this be?
>
> Kind Regards,
>
> Robert.
>
>
>
> SELECT ID_VN, CD_ITM_SPR
> FROM AS_ITM_SPR
> GROUP BY ID_VN, CD_ITM_SPR
> HAVING COUNT(*) > 1
>
>
>
>
> gbak: activating and creating deferred index AK_AS_ITM_SPR
> gbak:cannot commit index AK_AS_ITM_SPR
> gbak: ERROR:attempt to store duplicate value (visible to active transactions) in unique index "AK_AS_ITM_SPR"
> gbak: ERROR:action cancelled by trigger (3) to preserve data integrity
> gbak: ERROR: Cannot deactivate index used by a PRIMARY/UNIQUE constraint
> gbak:Exiting before completion due to errors

Sounds like a corrupt index. Your query above probably uses that index,
thus you won't see any result set. Executing the query without that
index, probably show duplicates then.



--
With regards,
Thomas Steinmaurer
http://www.upscene.com/