Thread: bytea problems

bytea problems

From
Lars Gustafsson
Date:
Hi,

I have an old Java-app that was developed a long time ago, it was written for Postgres version 8.

I have exported the DB from that old server and imported into a Postgres11 server.

Almost everything seems to work. Except when my app tries to fetch jpeg files stored in the DB as bytea.
The files I retrieve are unreadable. But when I look att the pictures in Postico they look good & I can save them and
openthem with other applications. 

I can add new pictures to the DB using the old app, they also works in Postico, but not when my app tries to read them
back.

Any hints? Have the way bytea data is selected changed? Should I try to select with some kind of decode function?

Regards,
Lars.


Re: bytea problems

From
Andreas Kretschmer
Date:

Am 24.05.19 um 11:10 schrieb Lars Gustafsson:
> Any hints? Have the way bytea data is selected changed? Should I try to select with some kind of decode function?

yeah, see bytea_output. Wild guess: it is set to 'hex'. Set it back to 
'escape'.
The default bytea output format has changed in 9.x, some years ago.


Regards, Andreas

-- 
2ndQuadrant - The PostgreSQL Support Company.
www.2ndQuadrant.com




Re: bytea problems

From
Lars Gustafsson
Date:
HA!! It works!! Fantastic!!

Thank you sooo much, you literally saved my day AND my weekend.

Vielen dank,
Lars.

> 24 maj 2019 kl. 11:51 skrev Andreas Kretschmer <andreas@a-kretschmer.de>:
>
>
>
> Am 24.05.19 um 11:10 schrieb Lars Gustafsson:
>> Any hints? Have the way bytea data is selected changed? Should I try to select with some kind of decode function?
>
> yeah, see bytea_output. Wild guess: it is set to 'hex'. Set it back to 'escape'.
> The default bytea output format has changed in 9.x, some years ago.
>
>
> Regards, Andreas
>
> --
> 2ndQuadrant - The PostgreSQL Support Company.
> www.2ndQuadrant.com
>
>
>