Subject Re: Backing up tables with procedures
Author Adam
> Thank You all and Adam.
> Tou are right, the FIB error was a table introduced by my Delphi
> program. I dropped that table and got a good backup with gbak. No
> errors. I however get error restoring it : The restored file is
fine
> but is missing some entries. And GOOD news, my procedures are back
in
> the restored file.
>
> Here the error i get:
> gbak: restoring index I_AR_SALESPEOPLE_NAME
> gbak: restoring data for table AR_SALESPEOPLE
> gbak: ERROR: validation error for column GLDEPT, value "*** null
***"
> gbak: ERROR: warning -- record could not be restored
> gbak: Exiting before completion due to errors
>
> I have to find out about this null value. ???

My prior response is sitting in dev/null. Sorry if it turns up later.
It is more detailed but this is the gist.

The usual reason for this is that someone has added a not null field
but has not made sure all pre-existing records in that table have
some value. Consequently, the restore is attempting to add a not null
constraint but has encountered a NULL value.

select *
from AR_SALESPEOPLE
where GLDEPT IS NULL;

Will show you the records you need to address. It is a bit of a
gotcha. They may have defined a default value, but this default value
is not applied retrospectively to existing records.

A simple update statement will get things working again.

For example

UPDATE AR_SALESPEOPLE
SET GLDEPT = 1
WHERE GLDEPT IS NULL;

(change 1 to whatever value is appropriate).

Adam