Re: Importing binary data

From: Chris Ruprecht <chris(at)cdrbill(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Importing binary data
Date: 2014-10-27 22:46:25
Message-ID: BF295D28-F59F-4A58-9976-1A15A1CB10EC@cdrbill.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks guys. I know what I will spend the night, doing ;).

> On Oct 27, 2014, at 16:33 , Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Chris Ruprecht <chris(at)cdrbill(dot)com> writes:
>> I can export the data out of that database into flat files just fine, but then I try to import the data to Postgres, I'm getting errors like this:
>
>> ERROR: invalid byte sequence for encoding "SQL_ASCII": 0x00
>> CONTEXT: COPY attachments, line 14: "58025 1 cl\Cert.r 10 M04P'15A415).($-H87)4:6UE+$-(05)!0U1%4BQ)3E!55"!I5&EM92!)3E1% M1T52'$585$523B!7..."
>
>> I tried LATIN1, SQL_ASCII, UTF-8, nothing works. I even tried to make the data type 'bytea', no luck. I'd love to have a "NO-CONVERSION" option on the copy command that just takes what ever bytes come along and doesn't try to interpret them.
>
> That's hardly possible, considering you're expecting COPY to recognize
> field and record boundaries. What you probably need to do here is declare
> the column as bytea and then write some sort of preprocessing script that
> converts the binary data into hex-encoded form (basically \x followed by
> hex digits, if memory serves, but check the description of bytea in the
> PG manual).
>
> regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Romu Hu 2014-10-28 09:21:49 Need guidance on regression.diffs
Previous Message Tom Lane 2014-10-27 20:33:49 Re: Importing binary data