From: Markus Wollny <Markus.Wollny@computec.de>
To: Chris Hoover <revoohc@gmail.com>
To: pgsql-admin@postgresql.org
Subject: Re: How to convert a string to bytea?
Date: Thu, 31 Aug 2006 15:41:51 +0200
Message-ID: <28011CD60FB1724DBA4442E38277F6260237C3D1@hermes.computec.de> (raw)
On 8/30/06, Chris Hoover <revoohc@gmail.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@postgresql.org
[mailto:pgsql-admin-owner@postgresql.org] Im Auftrag von Chris Hoover
Gesendet: Mittwoch, 30. August 2006 18:24
An: pgsql-admin@postgresql.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@gmail.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: Markus.Wollny@computec.de, revoohc@gmail.com
Subject: Re: How to convert a string to bytea?
In-Reply-To: <28011CD60FB1724DBA4442E38277F6260237C3D1@hermes.computec.de>
References: <28011CD60FB1724DBA4442E38277F6260237C3D1@hermes.computec.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox