Subject RE: [firebird-support] Firebird restore can not restore index due to duplicate value
Author Hugues Van Landeghem
Thanks Helen for your reply.



The 3 request you give me the same number of row before and after restoring
without index.



In the restored base this request give me some thing :



>SELECT t.table_id FROM TABLE t
>GROUP BY table_id
>HAVING count(*) > 1



So I delete the rows with problem in the original database and all go well.



Backup and restore now works well.



Best Regards,

Hugues



De : firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] De la part de Helen Borrie
Envoyé : vendredi 19 février 2010 04:34
À : firebird-support@yahoogroups.com
Objet : Re: [firebird-support] Firebird restore can not restore index due to
duplicate value





At 07:10 AM 19/02/2010, you wrote:
>Hi all,
>
>I have a problem with index when I restore database. I have this message:
>
>Quote:
>>Action cancelled by trigger(3) to preserve data integrity.
>>Cannot desactivate index use by a PRIMARY UNIQUE Constraint
>
>When I deactivate Index in restore : it works well.
>
>So I decide to make gfix and I get this
>Summary of validay errors :
>>Number of record level errors: 6
>>Number of index page errors : 9
>>When I decide to check the table with problem of primary unique key, I
make
>this
>
>SELECT t.table_id FROM TABLE t
>GROUP BY table_id
>HAVING count(*) > 1
>
>But I find nothing.

You have mixed aliased and non-aliased references here, which is not
supported in this version (although it is surprising you did not see an
exception).

>How I can see my duplicate value ? (I use Firebird 2.1.3)

Try
SELECT table_id, count(table_id)
FROM TABLE
GROUP BY 1
HAVING (count(table_id) > 1)

>Do you now any tools to find quickly where the error come ?

No, sorry. But I would first want to do these three queries and see whether
they come out with the same number:

select distinct count(table_id) from table
select count(table_id) from table
select count(*) from table

./heLen





[Non-text portions of this message have been removed]