0

I have a column that is bytea in postgres, and I can use a statement like this to get this kind of output:

select encode(mycolumn,'escape') from personTable;

and get:

254\355\000?sr\000?java.util.HashMap??\332\301\303?`\321?\000?F\000
loadFactorI\000 thresholdxp?@\000\000\000\000\000?w?\000\000\000?\000\000\000?t\000?      
userIdt\000
USER2200000x

How would I see this in plain text? It is indeed storing a java.util.HashMap-

1 Answer 1

5

This is really a Java issue rather than a PostgreSQL issue. personTable.mycolumn is holding a byte-string that was created using the Java Serialization API, and to retrieve the original object that the byte-string represents, you need to use that same API. (See "Discover the secrets of the Java Serialization API" for sample code.)

Sign up to request clarification or add additional context in comments.

2 Comments

ok, yup this makes sense, the application is saving serialized objects, i just didn't realize there wasnt a way to see the plain text in postgres. thanks!
How you solved the problem ? I also want to convert a bytea of postgres to Java String. please see my question here dba.stackexchange.com/questions/53309/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.