Re: How to cast VARCHAR to BYTEA and vice-versa?

From: "Moran(dot)Michael" <Michael(dot)Moran(at)IGT(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: How to cast VARCHAR to BYTEA and vice-versa?
Date: 2005-03-08 22:16:52
Message-ID: B27C8914860EE24E865D189A3735EA53100921@lasexch03.is.ad.igt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thank you, Tom.

Yes, the exact bytes in the varchar datum (without encoding) is what I would
like to become the bytes in the BYTEA.

So, how do I create a "cast WITHOUT FUNCTION" as you mention below? I assume
plpgsql is required, right?

Is there anyway this can be done in a VIEW without having to use plpgsql in
a Function (a.k.a. stored procedure)?

Is there no simple cast or conversion method I can call that does this for
me?

Best Regards,
Michael Moran

_____

From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: Tue 3/8/2005 9:18 AM
To: Moran.Michael
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] How to cast VARCHAR to BYTEA and vice-versa?

"Moran.Michael" <Michael(dot)Moran(at)IGT(dot)com> writes:
> How do I cast VARCHAR to BYTEA?

I think it would work to create a cast WITHOUT FUNCTION, assuming that
the semantics you want is that the exact bytes in the varchar datum
become the bytes in the bytea (no encoding or backslashing conversions).

regards, tom lane

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Oleg Bartunov 2005-03-08 23:05:47 fool-toleranced optimizer
Previous Message Tom Lane 2005-03-08 17:18:36 Re: How to cast VARCHAR to BYTEA and vice-versa?