Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9ad27c2

Browse files
committed
Document encode(bytea, 'escape')'s behavior correctly.
I changed this in commit fd15dba, but missed the fact that the SGML documentation of the function specified exactly what it did. Well, one of the two places where it's specified documented that --- probably I looked at the other place and thought nothing needed to be done. Sync the two places where encode() and decode() are described.
1 parent aa02864 commit 9ad27c2

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

doc/src/sgml/func.sgml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,7 +1506,8 @@
15061506
<entry>
15071507
Encode binary data into a textual representation. Supported
15081508
formats are: <literal>base64</>, <literal>hex</>, <literal>escape</>.
1509-
<literal>escape</> merely outputs null bytes as <literal>\000</> and
1509+
<literal>escape</> converts zero bytes and high-bit-set bytes to
1510+
octal sequences (<literal>\</><replaceable>nnn</>) and
15101511
doubles backslashes.
15111512
</entry>
15121513
<entry><literal>encode(E'123\\000\\001', 'base64')</literal></entry>
@@ -3234,12 +3235,12 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
32343235
<primary>decode</primary>
32353236
</indexterm>
32363237
<literal><function>decode(<parameter>string</parameter> <type>text</type>,
3237-
<parameter>type</parameter> <type>text</type>)</function></literal>
3238+
<parameter>format</parameter> <type>text</type>)</function></literal>
32383239
</entry>
32393240
<entry><type>bytea</type></entry>
32403241
<entry>
3241-
Decode binary string from <parameter>string</parameter> previously
3242-
encoded with <function>encode</>. Parameter type is same as in <function>encode</>.
3242+
Decode binary data from textual representation in <parameter>string</>.
3243+
Options for <parameter>format</> are same as in <function>encode</>.
32433244
</entry>
32443245
<entry><literal>decode(E'123\\000456', 'escape')</literal></entry>
32453246
<entry><literal>123\000456</literal></entry>
@@ -3250,13 +3251,16 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
32503251
<indexterm>
32513252
<primary>encode</primary>
32523253
</indexterm>
3253-
<literal><function>encode(<parameter>string</parameter> <type>bytea</type>,
3254-
<parameter>type</parameter> <type>text</type>)</function></literal>
3254+
<literal><function>encode(<parameter>data</parameter> <type>bytea</type>,
3255+
<parameter>format</parameter> <type>text</type>)</function></literal>
32553256
</entry>
32563257
<entry><type>text</type></entry>
32573258
<entry>
3258-
Encode binary string to <acronym>ASCII</acronym>-only representation. Supported
3259-
types are: <literal>base64</>, <literal>hex</>, <literal>escape</>.
3259+
Encode binary data into a textual representation. Supported
3260+
formats are: <literal>base64</>, <literal>hex</>, <literal>escape</>.
3261+
<literal>escape</> converts zero bytes and high-bit-set bytes to
3262+
octal sequences (<literal>\</><replaceable>nnn</>) and
3263+
doubles backslashes.
32603264
</entry>
32613265
<entry><literal>encode(E'123\\000456'::bytea, 'escape')</literal></entry>
32623266
<entry><literal>123\000456</literal></entry>

0 commit comments

Comments
 (0)