Re: Help : insert a bytea data into new table - Mailing list pgsql-sql

From Ben Morrow
Subject Re: Help : insert a bytea data into new table
Date
Msg-id 20100311180002.GA54548@osiris.mauzo.dyndns.org
Whole thread Raw
In response to Re: Help : insert a bytea data into new table  (Ben Morrow <ben@morrow.me.uk>)
List pgsql-sql
[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



pgsql-sql by date:

Previous
From: "Garrett Murphy"
Date:
Subject: Re: Trigger on select :-(
Next
From: Tony Wasson
Date:
Subject: Re: Remote monitoring of Postgres w/minimal grants