Re: [HACKERS] COPY bug? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] COPY bug?
Date
Msg-id 462.929304582@sss.pgh.pa.us
Whole thread Raw
In response to COPY bug?  (Chris Bitmead <chris.bitmead@bigfoot.com>)
List pgsql-hackers
Chris Bitmead <chris.bitmead@bigfoot.com> writes:
> Just wondering, when I do a COPY in the latest CVS into a file, it makes
> the file both where I ask it to AND in
> /home/postgres/data/base/<filename>. I've tried removing both files and
> doing it again, and it still happens. The one in /home/postgres looks
> like some kind of binary file.

Can't reproduce it here.  Anyone else seeing this?

If you do something likeCOPY int4_tbl TO 'int4out';
you will get the file dumped into the database directory, because that
is the current working directory of the backend; you need to give a
full path in this form of the COPY command to get the file put someplace
more useful.  But I don't see how COPY could produce two output files
when it's only doing one fopen()...

It occurs to me that it's a very dangerous thing for server-side COPY
to default to storing into the DB directory; pick the name of an
existing table and boom, you just overwrote your table.  Maybe the
server-side COPY command ought to insist on being given an absolute
path?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Massimo Dal Zotto
Date:
Subject: new patch
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] new patch