Subject | Re: [ib-support] Foreign key violation |
---|---|
Author | Nicorici Marcel |
Post date | 2003-01-17T08:26:42Z |
Hi
I think something missing in your letter.
I just try it and everything is OK .(of course, I
insert a record in table COUNTRY with ID=13)
Ciao, Marcel
--- Gabriel Juncu <gjuncu@...> wrote:
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
I think something missing in your letter.
I just try it and everything is OK .(of course, I
insert a record in table COUNTRY with ID=13)
Ciao, Marcel
--- Gabriel Juncu <gjuncu@...> wrote:
> Hi List,__________________________________________________
>
> I'm using Firebird 1.0.2 W32 and I'm having the
> following problem:
>
> 2 tables:
>
> Country:
> CREATE TABLE COUNTRY (
> ID NUMERIC(18,0) NOT NULL,
> NAME VARCHAR(50))
>
> ALTER TABLE COUNTRY ADD CONSTRAINT PK_COUNTRY
> PRIMARY KEY (ID);
>
> and Region:
> CREATE TABLE REGION (
> ID NUMERIC(18, 0) NOT NULL,
> NAME VARCHAR(50),
> COUNTRY_ID NUMERIC(18, 0));
>
> ALTER TABLE REGION ADD CONSTRAINT PK_REGION PRIMARY
> KEY (ID);
> ALTER TABLE REGION ADD CONSTRAINT FK_REGION_COUNTRY
> FOREIGN KEY (COUNTRY_ID) REFERENCES COUNTRY (ID);
>
> Nothing unusual yet, but after the following
> instructions:
>
> Start Transaction 1 and execute:
> UPDATE COUNTRY SET NAME = NAME where ID = 13;
>
> if I start Transaction 2 and execute:
> INSERT INTO REGION (ID, NAME, COUNTRY_ID) VALUES (1,
> 'SOME REGION NAME', 13)
> before commiting Transaction 1, I get the error:
>
> Unsuccessful execution caused by system error that
> does not preclude successful execution of subsequent
> statements.
> lock conflict on no wait transaction.
> violation of FOREIGN KEY constraint
> "FK_REGION_COUNTRY" on table "REGION".
>
> Both transactions are READ COMMITED, REC VERSION.
>
> Well, my question is: why I get this error, since
> the country with
> ID=13 exists in database?
>
> Best regards,
> Gabriel Juncu
>
>
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com