Thread: foreign key violation

foreign key violation

From
Larry Holish
Date:
Hello,

I am inserting rows from a temp table into table A using INSERT INTO.
Table A has a foreign key referencing table B's primary key.  I get
the following error:

<unnamed> referential integrity violation - key referenced from table
A not found in table B

Is there a way to tell which row(s) is causing the problem?  I am
using ver. 7.02. Thanks in advance,

--
Larry Holish
<ljholish@speakeasy.net>

Re: foreign key violation

From
Vijay Deval
Date:
If you put condition

WHERE primery key from ref. table= its mirror in temp table, the inserts
should  go through.

if objective is to find out the rows,  NOT EXISTS could be used on temp and
ref. table

Vijay

Larry Holish wrote:

> Hello,
>
> I am inserting rows from a temp table into table A using INSERT INTO.
> Table A has a foreign key referencing table B's primary key.  I get
> the following error:
>
> <unnamed> referential integrity violation - key referenced from table
> A not found in table B
>
> Is there a way to tell which row(s) is causing the problem?  I am
> using ver. 7.02. Thanks in advance,
>
> --
> Larry Holish
> <ljholish@speakeasy.net>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster