Subject | gfix & system tables question |
---|---|
Author | Didier Gasser-Morlay <Didiergm@nordnet.f |
Post date | 2003-02-14T09:05:59Z |
When using gfix I have not found a way to have some system table check
for data integrity : RDB$RELATION_CONSTRAINTS & RDB$REF_CONTRAINTS
where I could find some 'orphaned' rows
I understand the following
when creating as FK from tableA to tableB
there should an entry in
RDB$RELATION_CONSTRAINTS describing the name of the constraint, the
relation it applies to (TABLEA) and the name of the index to be used
(in the example of an FK)
RDB$REF_CONTRAINTS describing what PK is to be used and what action to
be taken (eg RESTRICT) when deleting or updating. (then it's simply a
matter of rereading RDB$RELATION_CONSTRAINTS to find out which table
it applies to.
I have found cases where there was 1 record in
RDB$RELATION_CONSTRAINTS and none on RDB$REF_CONTRAINTS and 1 example
of the contrary. FB does not choke on this and obviously this should
not happen in a live dn scenario, but can apparently happen with
developement databases.
QUESTIONS:
1:does gfix perform a sanity check on those tables and how to have it
do so ?
2:any idea on how this can happen & what are the steps to clean it
(there could be info I am missing).
3: Also to delete an index is it enough to delete the corresponding
entry in RDB$INDEX_SEGMENT or is there more to it ?
Thanks in advance
Didier
for data integrity : RDB$RELATION_CONSTRAINTS & RDB$REF_CONTRAINTS
where I could find some 'orphaned' rows
I understand the following
when creating as FK from tableA to tableB
there should an entry in
RDB$RELATION_CONSTRAINTS describing the name of the constraint, the
relation it applies to (TABLEA) and the name of the index to be used
(in the example of an FK)
RDB$REF_CONTRAINTS describing what PK is to be used and what action to
be taken (eg RESTRICT) when deleting or updating. (then it's simply a
matter of rereading RDB$RELATION_CONSTRAINTS to find out which table
it applies to.
I have found cases where there was 1 record in
RDB$RELATION_CONSTRAINTS and none on RDB$REF_CONTRAINTS and 1 example
of the contrary. FB does not choke on this and obviously this should
not happen in a live dn scenario, but can apparently happen with
developement databases.
QUESTIONS:
1:does gfix perform a sanity check on those tables and how to have it
do so ?
2:any idea on how this can happen & what are the steps to clean it
(there could be info I am missing).
3: Also to delete an index is it enough to delete the corresponding
entry in RDB$INDEX_SEGMENT or is there more to it ?
Thanks in advance
Didier