Subject Re: [firebird-support]Corruption of PK Index FB1.5
Author Helen Borrie
At 10:42 PM 21/01/2010, you wrote:
>Hi
>I have had a problem for some time with the PK index on one customer table.
>The database backs up fine.
>Restore using IBExpert interface -
>On restore it falls over with 'String truncation etc'
>On restore with verbose and commit each table it stops with . .
>gbak: committing data for table BI_MOVEMENT_LOG2
>gbak: 18119 records restored
>IBE: The insert failed because a column definition includes validation
>constraints.
>validation error for column REC, value "*** null ***".
>validation error for column REC, value "*** null ***".
>validation error for column REC, value "*** null ***".
>validation error for column ‰ø_^[ÐöÁ…K, value "(null)".
>IBE: Restore completed. Current time: 17:13:08. Elapsed time: 00:01:00
>
>If I drop the PK and examine the data there are no nulls in the PK field.
>If I reinstate the PK then it backs up and restores - for a while.
>
>Table definition is . .
>CREATE TABLE BI_MOVEMENT_LOG2 (
>REC INTEGER NOT NULL,
....
IF (NEW.REC IS NULL) THEN
>NEW.REC = GEN_ID(GEN_PURPOSE,1);
>END
>
>All the data is within the capacity of the fields.

Are you sure? REC is integer but, if the database is Dialect 3 then the generator will be generating BigInt numbers. An overflow *would* cause the message, if the trigger is firing when it encounters those nulls.

OTOH, if the DB is dialect 1 then maybe you have simply run out of integers. Try running
select GEN_ID(GEN_PURPOSE,0) from rdb$database;

./hb