Re: Exporting a PDF from a bytea column

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: CS DBA <cs_dba(at)consistentstate(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Exporting a PDF from a bytea column
Date: 2016-02-19 03:36:36
Message-ID: CAKFQuwayGkjeQBqMfPSW7XquUfDf62BKmqVso6bJTZh0tyCOAA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Feb 18, 2016 at 7:42 PM, CS DBA <cs_dba(at)consistentstate(dot)com> wrote:

>
> http://www.postgresql.org/message-id/AANLkTi=2dARHQPRGTXmCx0aus9maHQ2SfxxbvihtuzDv@mail.gmail.com
>
> 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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Victor Blomqvist 2016-02-19 03:45:47 Re: Query plan not updated after dropped index
Previous Message Deven Phillips 2016-02-19 02:48:02 Re: Appending key-value to JSONB tree