missing foreign key fails silently using COPY - Mailing list pgsql-bugs

From missive@frontiernet.net (Lee Harr)
Subject missing foreign key fails silently using COPY
Date
Msg-id slrna7j2ti.au.missive@whave.frontiernet.net
Whole thread Raw
Responses Re: missing foreign key fails silently using COPY  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
When COPYing data to a table which uses foreign keys, if there
is a reference to a key which is not there, the copy fails
(as expected) but there is no error message.

Hmm. Looking at it more, seems like there is an error message
when using:
COPY "f" FROM '/home/lee/f.dat';

but _not_ when using:
COPY "f" FROM stdin;
or
\copy f from f.dat


This is on:
 PostgreSQL 7.2 on i386-unknown-freebsd4.5, compiled by GCC 2.95.3


SELECT version();

DROP TABLE p;
DROP TABLE f;

CREATE TABLE p (
 pk int primary key
);

CREATE TABLE f (
 fk int references p
);

COPY "p" FROM stdin;
1
2
3
4
\.

COPY "f" FROM stdin;
1
2
3
4
5
\.

pgsql-bugs by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: Bug #602: Chinese characters query bug.
Next
From: Tom Lane
Date:
Subject: Re: missing foreign key fails silently using COPY