From: | "Markus Wollny" <Markus(dot)Wollny(at)computec(dot)de> |
---|---|
To: | "Chris Hoover" <revoohc(at)gmail(dot)com>, <pgsql-admin(at)postgresql(dot)org> |
Subject: | Re: How to convert a string to bytea? |
Date: | 2006-08-31 13:41:51 |
Message-ID: | 28011CD60FB1724DBA4442E38277F6260237C3D1@hermes.computec.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
On 8/30/06, Chris Hoover <revoohc(at)gmail(dot)com> wrote:
>I am in need of some help. I need to use the encode function
> against a text string in one of my pg/plsql functions.
> However, the encode function expects a bytea field to be
> passed to it. How do I convert my text string into a bytea?
I use two simple plpgsql functions to convert strings to and from bytea:
CREATE OR REPLACE FUNCTION text2bytea(text)
RETURNS bytea AS
$BODY$
begin
return $1;
end;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
and
CREATE OR REPLACE FUNCTION bytea2text(bytea)
RETURNS text AS
$BODY$
begin
return $1;
end;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
Kind regards
Markus
________________________________
Von: pgsql-admin-owner(at)postgresql(dot)org
[mailto:pgsql-admin-owner(at)postgresql(dot)org] Im Auftrag von Chris Hoover
Gesendet: Mittwoch, 30. August 2006 18:24
An: pgsql-admin(at)postgresql(dot)org
Betreff: Re: [ADMIN] How to convert a string to bytea?
Sorry, this was supposed to go to the -general list.
On 8/30/06, Chris Hoover <revoohc(at)gmail(dot)com> wrote:
I am in need of some help. I need to use the encode function
against a text string in one of my pg/plsql functions. However, the
encode function expects a bytea field to be passed to it. How do I
convert my text string into a bytea?
Thanks,
Chris
From | Date | Subject | |
---|---|---|---|
Next Message | Aaron Bono | 2006-08-31 14:22:41 | Re: Help about types please |
Previous Message | Ray Stell | 2006-08-31 13:02:11 | Re: Database Optimization and Peformance |