Re: PQescapeString/copy problem.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kurt Roeckx <Q(at)ping(dot)be>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: PQescapeString/copy problem.
Date: 2002-12-30 02:24:02
Message-ID: 15926.1041215042@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Kurt Roeckx <Q(at)ping(dot)be> writes:
> I'm using copy to import a table. I use PQescapeString() to make
> it safe, but it seems to have a problem when there is a ' in it.

PQescapeString is not designed to escape data for COPY, and will not
do the right thing. Quoting ' is not needed for COPY; what *is*
needed is quoting \n, \r, and \t (or whatever the column delimiter is).
And of course \.

Perhaps we should offer an alternative routine for quoting COPY data?
It would need to be told what the delimiter is supposed to be ...

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Palle Girgensohn 2002-12-30 02:38:59 why was libpq.so version bumped?
Previous Message Tom Lane 2002-12-30 01:50:09 Re: [Fwd: SETOF input parameters (was Re: [HACKERS] proposal: