Skip site navigation (1) Skip section navigation (2)

A question about constraints.

From: Stephen Ingram <ingram(at)samsix(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: A question about constraints.
Date: 2001-12-14 17:27:12
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice

I have added a constraint to a table to prevent it loading
data unless its key field is in another table (whose data
I have previously loaded)

ALTER TABLE OnMap ADD CONSTRAINT objid_check1   FOREIGN KEY (fname, lname)
                                                REFERENCES Object (fname, lname);

Indeed, the constraint works:

COPY OnMap FROM '/data/OnMap.dump' USING DELIMITERS '|'

psql:OnMap:1: ERROR:  objid_check1 referential integrity violation - key referenced
 from onmap not found in object

But... is there anyway to get PostgreSQL to tell me which record or records
are failing to load ?

I am assuming I am doing something stupid here.




pgsql-novice by date

Next:From: Leandro FanzoneDate: 2001-12-14 17:36:12
Subject: Re: Multiple IN
Previous:From: Josh BerkusDate: 2001-12-14 16:56:01
Subject: Re: Custom Reports

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group