From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | James Robinson <jlrobins(at)socialserve(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: COPY data and referential triggers ... |
Date: | 2004-10-23 23:55:37 |
Message-ID: | 28541.1098575737@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
James Robinson <jlrobins(at)socialserve(dot)com> writes:
> Just a sanity check -- data fed into pg using the
> COPY tablename (col1, col2) FROM stdin;
> ... data
> \.
> Does not cause referential triggers to fire (i.e. foreign keys), right?
Sure it does.
regression=# create table t1 (f1 int primary key);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "t1_pkey" for table "t1"
CREATE TABLE
regression=# create table t2 (f1 int references t1, f2 int);
CREATE TABLE
regression=# copy t2(f1,f2) from stdin;
Enter data to be copied followed by a newline.
End with a backslash and a period on a line by itself.
>> 3 4
>> \.
ERROR: insert or update on table "t2" violates foreign key constraint "$1"
DETAIL: Key (f1)=(3) is not present in table "t1".
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Karim Nassar | 2004-10-24 00:08:04 | Re: Duplicating a database |
Previous Message | Tom Lane | 2004-10-23 23:52:50 | Re: '1 year' = '360 days' ???? |