pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Fuhr <mike@fuhr.org>
To: Markus Bertheau ??? <twanger@bluetwanger.de>
Cc: pgsql-sql@postgresql.org
Subject: Re: SQL repr of bytea val
Date: Mon, 20 Jun 2005 18:12:40 -0600
Message-ID: <20050621001240.GA28117@winnie.fuhr.org> (raw)
In-Reply-To: <1119275221.4688.14.camel@dicaprio.akademie1.de>
References: <1119275221.4688.14.camel@dicaprio.akademie1.de>

On Mon, Jun 20, 2005 at 03:47:01PM +0200, Markus Bertheau ??? wrote:
> 
> I'm constructing querys on the fly in PL/pgSQL_ and need a function that
> returns the SQL representation of a bytea value. I tried encode(..,
> 'escape') but it seems to return 8 bit ASCII values, not the \377 stuff
> that's supposed to be in the bytea input syntax. Does anyone know a way
> to do that?

How about textin(byteaout(bytea_value))?  Or a function that performs
the conversion by magic:

CREATE FUNCTION bytea2text(bytea) RETURNS text AS $$
BEGIN
    RETURN $1;
END;
$$ LANGUAGE plpgsql IMMUTABLE STRICT;

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/



view thread (2+ messages)

Message-ID: <20050621001240.GA28117@winnie.fuhr.org>
Permalink:  ../20050621001240.GA28117@winnie.fuhr.org/
Also on:    postgresql.org/message-id/20050621001240.GA28117@winnie.fuhr.org

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mike@fuhr.org, twanger@bluetwanger.de
  Subject: Re: SQL repr of bytea val
  In-Reply-To: <20050621001240.GA28117@winnie.fuhr.org>

* 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