On 2013-03-26, Tom Lane <t...@sss.pgh.pa.us> wrote:

> The manual says that 'escape' encoding "merely outputs null bytes as
> \000 and doubles backslashes".  

> (Having said that, I wonder though if "escape" doesn't need more
> thought.  The output is only valid text in SQL_ASCII or single-byte
> encodings, otherwise there's risk of encoding violations.)

it does that too, since as long as I can remember.
I used decode-hex here so it'll work on older version of pg.

select encode(decode('ee5c2700aa','hex'),'escape');
    encode    
--------------------
 \356\\'\000\252

to see the slashes doubled you need to run it through quote-literal

select quote_literal(encode(decode('ee5c2700aa','hex'),'escape'));
      quote_literal       
--------------------------
 E'\\356\\\\''\\000\\252'
       
-- 
⚂⚃ 100% natural



-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to