Re: Exporting a PDF from a bytea column - Mailing list pgsql-general

From David G. Johnston
Subject Re: Exporting a PDF from a bytea column
Date
Msg-id CAKFQuwayGkjeQBqMfPSW7XquUfDf62BKmqVso6bJTZh0tyCOAA@mail.gmail.com
Whole thread Raw
In response to Re: Exporting a PDF from a bytea column  (CS DBA <cs_dba@consistentstate.com>)
List pgsql-general
On Thu, Feb 18, 2016 at 7:42 PM, CS DBA <cs_dba@consistentstate.com> wrote:

Short answer, to avoid the binary blob problem, is to encode the binary data, export it, then decode it.

This can be done is psql.  If your client can handle binary directly (e.g, JDBC/Java) you can use that language's facilities to perform the binary transfer directly thus bypassing the need to transcode.
Can it be done from a Linux shell script?  Any examples? Seems to be little info on this in my googling?

​Others may provide actual examples but at the moment I don't have the time to explore to that depth.

To answer your "shell script" question...anything can be done in a shell script - as long as you have the right programs on your system to do the actual work.  I already mentioned "psql" which, if you want the least amount of pure "coding", is going to be the helper program you will want to use.  And its usage is well documented.  I would suggest base64 encoding and then using whatever standard base64 decoder program exists on your Linux box to perform the decoding.

David J.

pgsql-general by date:

Previous
From: Deven Phillips
Date:
Subject: Re: Appending key-value to JSONB tree
Next
From: Victor Blomqvist
Date:
Subject: Re: Query plan not updated after dropped index