Re: decoding BLOB's

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: CS DBA <cs_dba(at)consistentstate(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: decoding BLOB's
Date: 2016-02-22 19:23:31
Message-ID: 56CB6033.1000905@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 02/22/2016 11:08 AM, CS DBA wrote:
> Hi All;
>
> we've found a post about dumping blobs:
> /
> /
>
> /I wrote: [fanlijing wants to write bytea to file] > A simple > COPY
> (SELECT byteacol WROM mytab WHERE ...) TO 'filename' (FORMAT binary) >
> should do the trick. Corrections: a) "binary" must be surrounded by
> single quotes. b) *that won't dump just the binary data - you would have
> to remove the first 25 bytes and the last 2 bytes...* So maybe using the
> functions I mentioned would be the best way after all. You could also
> write your own user defined function in C. /
>
>
>
> Can someone point me in the right direction per how I would remove the
> first 25 bytes and the last 2 bytes from a bytea column?

http://www.postgresql.org/docs/9.3/static/functions-binarystring.html

Substring might do it for you.

JD

>
> Thanks in advance
>
>

--
Command Prompt, Inc. http://the.postgres.company/
+1-503-667-4564
PostgreSQL Centered full stack support, consulting and development.
Everyone appreciates your honesty, until you are honest with them.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephen Frost 2016-02-22 19:33:25 Re: Why does query planner choose slower BitmapAnd ?
Previous Message CS DBA 2016-02-22 19:08:09 decoding BLOB's