Subject Re: [firebird-support] Cannot restore primary key constraint after removing
Author Carlos Tré
On 22/11/2013 15:24, scottb@... wrote:
attempt to store duplicate value (visible to active transactions) in unique index "PK_CHARGE"

I have checked count on the primary key field, and there appears to be only one instance for each "CHARGE_TABLE_ID".  I have backed up and restored the database, and then tried adding the constraint, but same error message.



It has happened to me just yesterday, in a similar situation. It was a duplicated value in a unique column.

Try

select CHARGE_TABLE_ID, count(*)
 from CHARGE
 group by CHARGE_TABLE_ID
 having count(*) > 1;

And see if you can spot a duplicated value.

Best,
Carlos