pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ben Morrow <ben@morrow.me.uk>
To: dennis.mails@gmail.com
To: pgsql-sql@postgresql.org
Subject: Re: Help : insert a bytea data into new table
Date: Thu, 11 Mar 2010 18:00:02 +0000
Message-ID: <20100311180002.GA54548@osiris.mauzo.dyndns.org> (raw)
In-Reply-To: <hnb4gi$4rr$1@news.hub.org>
References: <hn49e1$2eob$1@news.hub.org>
	<20100309034626.GA12083@osiris.mauzo.dyndns.org>
	<20100309111410.GA15752@osiris.mauzo.dyndns.org>
	<20100310152510.GA37991@osiris.mauzo.dyndns.org>
	<20100311114648.GA50794@osiris.mauzo.dyndns.org>

[quoting fixed]

Quoth dennis <dennis.mails@gmail.com>:
> Ben Morrow wrote:
> > Quoth dennis<dennis@teltel.com>:
> >> Dear Ben
> >>
> >>      thanks for you anwser.
> >> I try to add function quote_literal on my sql statement .
> >>
> >> but it raise other error message (quote_literal not support bytea format):
> >>        function quote_literal(bytea) does not exist
> >
> > Which Postgres version are you using?
>
> Postgres : 8.1.4

Then I think you want 

    create function quote_literal (bytea)
        returns text
        immutable strict
        language plpgsql
        as $$ 
            begin
                return 'E'''
                    || replace(encode($1, 'escape'), E'\\', E'\\\\')
                    || '''';
            end;
        $$;

Ben




view thread (9+ messages)

Message-ID: <20100311180002.GA54548@osiris.mauzo.dyndns.org>
Permalink:  ../20100311180002.GA54548@osiris.mauzo.dyndns.org/
Also on:    postgresql.org/message-id/20100311180002.GA54548@osiris.mauzo.dyndns.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: ben@morrow.me.uk, dennis.mails@gmail.com
  Subject: Re: Help : insert a bytea data into new table
  In-Reply-To: <20100311180002.GA54548@osiris.mauzo.dyndns.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