Re: foreign key violation

From: Vijay Deval <deval(at)giaspn01(dot)vsnl(dot)net(dot)in>
To: Larry Holish <ljholish(at)speakeasy(dot)net>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: foreign key violation
Date: 2001-04-10 15:55:10
Message-ID: 3AD32CDE.883CF2A2@giaspn01.vsnl.net.in
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

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(at)speakeasy(dot)net>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Helge Bahmann 2001-04-10 16:16:15 Re: Buggy SELEC ... FROM UPDATE ?
Previous Message Don Miller 2001-04-10 15:03:42 Re: No echo on psql command - never mind...