Re: Add encoding support to COPY

From: David Blewett <david(at)dawninglight(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Add encoding support to COPY
Date: 2009-07-15 17:53:01
Message-ID: 9d1f8d830907151053r270f6b65v2162d6853b30294@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Apologies to Tom for the duplicate...

On Wed, Jul 15, 2009 at 12:17 PM, Tom Lane<tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Well, it might make sense to allow an ENCODING option attached to a COPY
> with a file source/destination.  I remain of the opinion that overriding
> client_encoding on a transfer to/from the client is a bad idea.

I really don't see how it is any different from manually flipping the
client_encoding before/after the transfer. We could of course put a
warning sign in the docs, but it seems to me it's more error prone for
clients to set the client_encoding manually rather than include an
option for a single command. What happens if an exception is thrown
during the COPY process and the client doesn't handle things
correctly? The rest of their session could be in an unexpected
encoding, whereas with this method we know to return to the original
client_encoding before doing anything else. By including the encoding
option, their explicitly saying how they want to handle the data.

I could see a use case for remote client code to do a COPY to STDOUT,
that is actually being redirected to a file. If the consensus is for
local file-based operations only, however, I can structure the patch
that way.

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bernd Helmle 2009-07-15 18:05:28 Re: Add encoding support to COPY
Previous Message Böszörményi Zoltán 2009-07-15 17:17:17 Split-up ECPG patches