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

copy works, \copy doesn't

From: Paul Buder <paulb(at)aracnet(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: copy works, \copy doesn't
Date: 2002-11-09 19:30:52
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs
Sorry for the duplicate post.  I forgot to mention this is with
Postgresql 7.2.2.

It seems the psql \copy command doesn't work properly when dealing
with certain non-ascii characters (which ones I don't know).  At any rate
I took some binary data and escaped it like so with perl.


In other words I escaped escape characters, newlines and tabs.

I made a table like this
CREATE TABLE "testtable" (
	"somenumber" integer DEFAULT '0' NOT NULL,
	"sometext" text DEFAULT '' NOT NULL

I made my input file by printing out a asciified number, a tab,
the text above and a newline.  This is the attached file.
In the event attached files get stripped by the mailing list it
is also at

When I do
copy testtable from '/home/paulb/sample-data';
it works fine.

When I do
\copy testtable from '/home/paulb/sample-data'
I get ERROR:  copy: line 2, pg_atoi: error in "(binary gobbledygook)

Attachment: sample-data
Description: application/octet-stream (155 bytes)

pgsql-bugs by date

Next:From: Paul BuderDate: 2002-11-09 23:16:09
Subject: I was wrong about Re: copy works, \copy doesn't (fwd)
Previous:From: Paul BuderDate: 2002-11-09 18:45:39
Subject: copy works, \copy doesn't

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