Re: Escaping input from COPY - Mailing list pgsql-general

From Josh Kupershmidt
Subject Re: Escaping input from COPY
Date
Msg-id CAK3UJRHef9rphY=wx0OhW-LPMQWWGxV7NQY-o2m+6_m+DopzAg@mail.gmail.com
Whole thread Raw
In response to Escaping input from COPY  (Roger Leigh <rleigh@codelibre.net>)
Responses Re: Escaping input from COPY  (Adrian Klaver <adrian.klaver@gmail.com>)
List pgsql-general
On Mon, Dec 19, 2011 at 6:56 AM, Roger Leigh <rleigh@codelibre.net> wrote:

> I'd like to switch to COPY, which should be orders of
> magnitude faster.  I see that DBD::Pg has an interface for
> this, which looks just fine.  My problem is with how to
> escape the data.  I need to use whatever escaping rules
> are in use by the server, which I've seen documented in
> the manual; but in order to cope with any future changes
> to these rules, and ensure identical behaviour, are there
> any standard functions I can use to escape the data before
> loading it?

This is really a question for the DBD::Pg folks, I think. Looking at:
  http://search.cpan.org/~turnstep/DBD-Pg-2.16.1/Pg.pm#COPY_support

It doesn't look like there is support for escaping COPY data. But
incidentally, I recently brought up the same problem with psycopg2 on
the psycopg list, and it seems there's no existing solution there,
either. Going out on a limb, I'm guessing that connectors don't offer
this support because there is no function in libpq for them to wrap,
and they don't want to kludge their own.

Anyone else think it might be a good idea for libpq to offer some
function to escape text to be used by COPY?

Josh

pgsql-general by date:

Previous
From: Chris Travers
Date:
Subject: Re: Postgres Logs question
Next
From: Culley Harrelson
Date:
Subject: design help for performance