Re: Escaping input from COPY

From: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
To: Roger Leigh <rleigh(at)codelibre(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Escaping input from COPY
Date: 2011-12-20 23:56:14
Message-ID: CAK3UJRHef9rphY=wx0OhW-LPMQWWGxV7NQY-o2m+6_m+DopzAg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Dec 19, 2011 at 6:56 AM, Roger Leigh <rleigh(at)codelibre(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Culley Harrelson 2011-12-20 23:56:49 design help for performance
Previous Message Chris Travers 2011-12-20 22:35:23 Re: Postgres Logs question