How to cast VARCHAR to BYTEA and vice-versa?

From: "Moran(dot)Michael" <Michael(dot)Moran(at)IGT(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: How to cast VARCHAR to BYTEA and vice-versa?
Date: 2005-03-08 16:56:47
Message-ID: B27C8914860EE24E865D189A3735EA53100920@lasexch03.is.ad.igt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello all,

I have a table with a VARCHAR column that I need to convert to a BYTEA.

How do I cast VARCHAR to BYTEA?

The following doesn't seem to work as it yields the 'cannot cast varchar to
bytea' error message:

varchar_data::bytea

On the same topic, how do I do the reverse, that is, how to I cast from
BYTEA back to VARCHAR?

Thanks,
-Michael Moran

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-03-08 17:18:36 Re: How to cast VARCHAR to BYTEA and vice-versa?
Previous Message Tom Lane 2005-03-08 16:52:39 Re: ERROR: unrecognized node type in PostgresMain( )