Subject | Re: [firebird-support] Referential constraints not defined |
---|---|
Author | Tim Ledgerwood |
Post date | 2003-10-13T12:41:53Z |
Ummmm - why? I mean, why would it be bad?
Thanks
Tim
At 10:37 PM 13/10/2003 +1000, you wrote:
Thanks
Tim
At 10:37 PM 13/10/2003 +1000, you wrote:
>At 02:29 PM 13/10/2003 +0200, you wrote:[Non-text portions of this message have been removed]
> >Hi all,
> >
> >I need to implement strict referential integrity for an accounts db. I keep
> >on getting the following error :
> >
> >Unsuccessful metadata update
> >STORE RDB$REF_CONSTRAINTS failed
> >action cancelled by trigger (1) to preserve data integrity
> >Name of Referential Constraint not defined in constraints table
> >Statement: ALTER TABLE "ACCOUNTS" ADD CONSTRAINT "FK_ACCOUNT_ACCOUNT_TYPE"
> >FOREIGN KEY ("ACCOUNT_TYPE") REFERENCES ACCOUNTTYPETABLE ("RECORDNO")
> >
> >Metadata for Sub accounts:
> >
> >CREATE TABLE "SUB_ACCOUNTS"
> >(
> > "RECORDNO" "DOM_RECNUM",
> > "ACCOUNT_NUMBER" "DOM_CODE",
> > "SUB_ACCOUNT_NUMBER" "DOM_CODE",
> > "SUB_ACCOUNT_CODE" "DOM_CODESTRING",
> > "SUB_ACCOUNT_NAME" "DOM_DESCRIP",
> > "SUB_ACCOUNT_TYPE" "DOM_ACCTYPE",
> > "SUB_TAX_TYPE" "DOM_TAXRATING",
> > PRIMARY KEY ("RECORDNO"),
> >CONSTRAINT "UN_SUBACC_ACCOUNTCODE" UNIQUE ("SUB_ACCOUNT_CODE"),
> >CONSTRAINT "UN_SUBACC_ACCOUNTNUMBER" UNIQUE ("SUB_ACCOUNT_NUMBER")
> >);
> >
> >Metadata for Account Type Table :
> >
> >/* Table: ACCOUNTTYPETABLE, Owner: SYSDBA */
> >
> >CREATE TABLE "ACCOUNTTYPETABLE"
> >(
> > "RECORDNO" "DOM_RECNUM",
> > "DESCRIPTION" "DOM_DESCRIP",
> > "ABBREVIATION" "DOM_ABBREV",
> > PRIMARY KEY ("RECORDNO"),
> >CONSTRAINT "UN_ACTYPE_ABBREV" UNIQUE ("ABBREVIATION")
> >);
> >
> >Anyone know what I'm doing wrong?
>
>Did you paste the wrong metadata here?
>
>Maybe this is just God's way of telling you that this would be a **very
>bad** foreign key. (it would, you know!) Write your own trigger to
>enforce the integrity, and avoid that terrible index you're going to get if
>you implement that FK.
>
>heLen
>
>
>
>
>To unsubscribe from this group, send an email to:
>firebird-support-unsubscribe@yahoogroups.com
>
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>
>---
>Incoming mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.521 / Virus Database: 319 - Release Date: 23/09/2003