Re: problems with copy from file

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Andreas Kretschmer <akretschmer(at)spamfence(dot)net>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: problems with copy from file
Date: 2015-10-16 00:19:45
Message-ID: 562042A1.8090701@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/14/15 11:40 AM, Andreas Kretschmer wrote:
> test=*# \copy httpd_log (data) from '~/test.log';
> ERROR: invalid byte sequence for encoding "UTF8": 0xb1
> CONTEXT: COPY httpd_log, line 3: "other-domain bb.243.xx.yyy - - [06/Nov/2014:00:48:22 +0100] "\x16\x03\x01\x01\xb1\x01" 501 10..."

I don't think it's possible with COPY. The issue is that COPY is passing
the string to text_in() to process, and text_in is treating that as an
escape sequence (which it is...).

You could maybe create a raw_text type that had a different input
function and define a view that had that type and a trigger to put the
data in the table. You wouldn't want to use raw_text in a table though,
because you wouldn't be able to safely dump and restore it.
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gavin Flower 2015-10-16 01:28:25 Re: ID column naming convention
Previous Message Jim Nasby 2015-10-16 00:09:29 Re: ID column naming convention