X-Original-To: pgsql-admin-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id E503B9FB3C8 for ; Thu, 31 Aug 2006 11:22:04 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 97197-01-10 for ; Thu, 31 Aug 2006 11:21:53 -0300 (ADT) X-Greylist: delayed 00:27:24.204168 by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 577479FB3DC for ; Thu, 31 Aug 2006 11:13:15 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from smtpgw.computec.de (unknown [212.123.108.8]) by svr4.postgresql.org (Postfix) with ESMTP id 103DD5AF03C for ; Thu, 31 Aug 2006 13:45:50 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by smtpgw.computec.de (Postfix) with ESMTP id 462742EC0E; Thu, 31 Aug 2006 15:45:45 +0200 (CEST) Received: from smtpgw.computec.de ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 32636-01-22; Thu, 31 Aug 2006 15:45:44 +0200 (CEST) Received: from HERMES.computec.de (unknown [192.168.0.22]) by smtpgw.computec.de (Postfix) with ESMTP id B13022EBAC; Thu, 31 Aug 2006 15:45:44 +0200 (CEST) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable Subject: Re: How to convert a string to bytea? Date: Thu, 31 Aug 2006 15:41:51 +0200 Message-ID: <28011CD60FB1724DBA4442E38277F6260237C3D1@hermes.computec.de> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [ADMIN] How to convert a string to bytea? Thread-Index: AcbMUGfxPsi3RLxyTy6a/oWB6SmV8wAsnbtg From: "Markus Wollny" To: "Chris Hoover" , X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at computec.de X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200608/345 X-Sequence-Number: 22888 On 8/30/06, Chris Hoover wrote:=20 >I am in need of some help. I need to use the encode function=20 > against a text string in one of my pg/plsql functions. =20 > However, the encode function expects a bytea field to be=20 > passed to it. How do I convert my text string into a bytea?=20 =09 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 wrote:=20 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?=20 =09 Thanks, =09 =09 Chris =09