missing foreign key fails silently using COPY

From: missive(at)frontiernet(dot)net (Lee Harr)
To: pgsql-bugs(at)postgresql(dot)org
Subject: missing foreign key fails silently using COPY
Date: 2002-02-25 00:58:32
Message-ID: slrna7j2ti.au.missive@whave.frontiernet.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

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
\.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message pgsql-bugs 2002-02-25 01:48:14 Bug #602: Chinese characters query bug.
Previous Message Tom Lane 2002-02-24 03:19:33 Re: [PATCHES] COPY when 'filename' is a directory

Browse pgsql-hackers by date

  From Date Subject
Next Message Fernando Nasser 2002-02-25 01:11:43 Re: [HACKERS] Updated TODO item
Previous Message Andrew McMillan 2002-02-25 00:09:07 Re: Duration of beta period