Re: copy with escape

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "blackwater dev" <blackwaterdev(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: copy with escape
Date: 2008-02-26 03:07:13
Message-ID: 22522.1203995233@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"blackwater dev" <blackwaterdev(at)gmail(dot)com> writes:
> I have data that I'm running through pg_escape_sting in php and then adding
> to stdin for a copy command. The problem is "O'reilly" is being changed to
> "O''Reilly" in the string and then in the db.

pg_escape_string is designed to produce a string properly quoted for use
as a literal in a SQL command. It is completely wrong for data that is
to go into COPY input. I kinda doubt that PHP has anything built-in
that's suitable for COPY, though I could be wrong ...

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message brian 2008-02-26 03:25:39 Re: copy with escape
Previous Message blackwater dev 2008-02-26 02:20:24 copy with escape