How can convert bytea to base64 in Postgres

Viewed 6414

I have now facing the problem in bytea to Base64, actually I have save the image in below query,

user_profile_pic is defind in bytea in table

Update user_profile_pic
Set user_profile_pic = (profilepic::bytea)
Where userid = userid;

after that I have select the below query,

case 1:  
SELECT user_profile_pic  
  FROM user_profile_pic;

its return exact same as I have updated, but after passing service its display a byte format

case 2:  
Select encode(user_profile_pic::bytea, 'base64')  
FROM user_profile_pic;

it returns totally different result.

I want to result case 1 along with service?

1 Answers
Related