psql and COPY - Mailing list pgsql-hackers

From Oliver Elphick
Subject psql and COPY
Date
Msg-id 200001171434.OAA01785@linda.lfix.co.uk
Whole thread Raw
Responses Re: [HACKERS] psql and COPY
List pgsql-hackers
Peter, there seem to be problems with the COPY statement when psql is run
with redirected stdin.

If I have a file ${DUMPDIR}/dbdump.product containing:

COPY product FROM stdin;
05 \N 000000   \N \N S  D9 t  f  f  f  POLY BAGS-BLACK      .        Single   f
...
\.


and I run this command:
psql -e -d bray < ${DUMPDIR}/dbdump.product

no error messages are seen.

If I remove the COPY command from the file and run the COPY frpm inside
psql, I see the errors:

bray=> copy product from '/tmp/dbdump.product';
ERROR:  <unnamed> referential integrity violation - key referenced from 
product not found in brandname

-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver              PGP key from public servers; key
ID32B8FAA1                ========================================    "And, behold, I come quickly; and my reward is
withme,     to give every man according as his work shall be."                                  Revelation 22:12 
 




pgsql-hackers by date:

Previous
From: Hakan Tandogan
Date:
Subject: Re: [HACKERS] Auto-lowercasing of column names?
Next
From: Theo Kramer
Date:
Subject: Re: [HACKERS] DefineQueryRewrite: rule plan string too big.