Importing binary data - Mailing list pgsql-general

From Chris Ruprecht
Subject Importing binary data
Date
Msg-id B99FC604-79E2-4E95-9FF0-EC6CC395E583@cdrbill.com
Whole thread Raw
Responses Re: Importing binary data
Re: Importing binary data
List pgsql-general
Hey guys,

I was given a database back of a non-PostgreSQL database. That database contains records where some binary file (looks
likeemail attachments) was imported into several chunks of X characters in length and then stored into multiple
records.A messy way of storing BLOB data. The database encoding is LATIN1, ISO8859-1. 
There chunks are actually 50 fields of 60 bytes each per row. If the original file is larger than that, more than one
rowis used. 

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'mgetting 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.

Any ideas of what I can do to import this stuff?


best regards,
chris
--
chris ruprecht
database grunt and bit pusher extraordinaíre



pgsql-general by date:

Previous
From: basti
Date:
Subject: Re: pg killed by oom-killer, "invalid contrecord length 2190 at A6C/331AAA90" on slaves
Next
From: David G Johnston
Date:
Subject: Re: Importing binary data