Subject Re: restore - attempt to store duplicate value
Author Adam
--- In, "mat" <mpaczek@k...> wrote:
> Hi All.
> During restore of my database using FB've got the
following error "Attempt to store duplicated value (visible to active
transactions) in unique index rdb$index_2". Restore with deactivated
indexes doesn't work also. So is my database corrupted seriously? And
how can I fix it? How can I find out which values are duplicated?
> Thanks for any help.
> greetings,
> mat


If you still have the original Look for rdb$index_2 to find out what
it is, then drop index. Write a query like this

select id, count(*)
from mytable
group by id
having count(*) > 1

(where id is your supposedly unique field)

If the index is too complex to drop, then you can probably trick the
optimiser to not use it.

select id+0, count(*)
from mytable
group by 1
having count(*) > 1

(hopefully it is a reasonably small table)