#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2006
    Posts
    205
    Rep Power
    15

    Database validation


    Hi there!

    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:
    IBE: Validation completed, no errors found

    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,
    Szilvi


    PS:
    The constraint works fine. If i want to insert a new record without completing COUNTRY, it says:

    The insert failed because a column definition includes validation constraints.
    validation error for column COUNTRY, value "*** null ***".
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2006
    Posts
    205
    Rep Power
    15
    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...
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2006
    Location
    Plovdiv. Bulgaria
    Posts
    226
    Rep Power
    12
    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.

IMN logo majestic logo threadwatch logo seochat tools logo