I have a problem with database validation.
Recently i had an issue at restoring a firebird database from backup.
During the restore operation i've got a validation error message column COUNTRY mustn't have NULL value.
Since i never met such a thing i didn't know how to handle it...so i checked the argument list of gbak and found the -n option which sounded pretty good. I ran the restore command again, this time with -n option and everything went smoothly.
Then i realized that one record in the CITIES table has NULL value at the COUNTRY column. I corrected it and life went on...
After a couple of days i observed that ALL columns in ALL my tables and ALL domains have lost the NOT NULL property. (I wonder if anything else is lost too?!?)
For now i corrected all my tables and want to learn of my mistake.
I reproduced the same error:
- removed the NOT NULL form the COUNTRY column in the CITIES tables
- updated a record to have the COUNTRY=NULL
- set the COUNTRY again as NOT NULL
then i ran:
gfix -v -full
it says nothing
then i tried with IBExpert's Database Validation option which actually does the same thing. That says:
And here's the question:
How can i validate my database every now and then? How can i list all errors so i will have no surprise at next backup/restore?
Thanks a lot,
The constraint works fine. If i want to insert a new record without completing COUNTRY, it says:
Okay, I solved the problem by creating a batch file that would createa backup and restore it in a test database. So i can run it every now and then and i see if there's an error.
But still...other solutions are welcome too...
I thing that the validation is to check the structure of the database file - not the data in it. It checks for wrong page types, missing pages, wrong indexes and stuffs like that. It doesn't check the data in the tables.