Subject RE: [firebird-support] Re: Automatically deleting bad duplicate records
Author Alan McDonald
> > > Does the database have forced writes on?
> >
> > Forced writes was not on when corruption took place, we have since
> > switched forced writes on.
> Robert,
> You need not investigate any further. Having Forced writes switched off
> means that when the database writes a page, the OS can cache the
> changes. It is possible that there was a problem (my guess power loss)
> between the record being written to the data page and the index page
> being updated to reflect the new record. The constraint checks rely on
> this index to detect whether a value exists or not. Forced writes
> forces the changes to be persisted to disk immediately as they are
> made. This means that the record would have been long on disk before
> the power went off.

I don't think this is the most likely reason. The chance of having forced
writes off, suffering a duplicate PK value as you say and not a rather nasty
DB corruption is so slim that I don't think it's possible.

in 1.0.2 you *could* deactivate both primary and foreign key

I assume this was fixed but it's worth checking your version to ensure that
PK indexes were/are active.