bytea_ouput = escape vs encode(byte, 'escape') - Mailing list pgsql-hackers

From Jim Nasby
Subject bytea_ouput = escape vs encode(byte, 'escape')
Date
Msg-id 6C8528E8-CF24-48BB-85E0-41D72C20B1AC@nasby.net
Whole thread Raw
Responses Re: bytea_ouput = escape vs encode(byte, 'escape')
List pgsql-hackers
I'm wondering why bytes_output = escape produces different output than encode(byte, 'escape') does. Is this
intentional?If so, why? 

cnuapp_prod@postgres=# select e'\r'::bytea AS cr, e'\n'::bytea AS lf; cr  |  lf
------+------\x0d | \x0a
(1 row)

cnuapp_prod@postgres=# set bytea_output = escape;
SET
cnuapp_prod@postgres=# select e'\r'::bytea AS cr, e'\n'::bytea AS lf; cr  |  lf
------+------\015 | \012
(1 row)

cnuapp_prod@postgres=# select encode(e'\r'::bytea,'escape') AS cr, encode(e'\n'::bytea, 'escape') AS lf;cr | lf
----+----\r |   +   |
(1 row)

cnuapp_prod@postgres=#
--
Jim C. Nasby, Data Architect                       jim@nasby.net
512.569.9461 (cell)                         http://jim.nasby.net




pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Modify the DECLARE CURSOR command tag depending on the scrollable flag
Next
From: Robert Haas
Date:
Subject: Re: Suggestion: Issue warning when calling SET TRANSACTION outside transaction block