Skip to content

Commit d2b8d06

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 723acc9 commit d2b8d06

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
@@ -1505,7 +1505,8 @@
15051505
<entry>
15061506
Encode binary data into a textual representation. Supported
15071507
formats are: <literal>base64</>, <literal>hex</>, <literal>escape</>.
1508-
<literal>escape</> merely outputs null bytes as <literal>\000</> and
1508+
<literal>escape</> converts zero bytes and high-bit-set bytes to
1509+
octal sequences (<literal>\</><replaceable>nnn</>) and
15091510
doubles backslashes.
15101511
</entry>
15111512
<entry><literal>encode(E'123\\000\\001', 'base64')</literal></entry>
@@ -3020,12 +3021,12 @@
30203021
<primary>decode</primary>
30213022
</indexterm>
30223023
<literal><function>decode(<parameter>string</parameter> <type>text</type>,
3023-
<parameter>type</parameter> <type>text</type>)</function></literal>
3024+
<parameter>format</parameter> <type>text</type>)</function></literal>
30243025
</entry>
30253026
<entry><type>bytea</type></entry>
30263027
<entry>
3027-
Decode binary string from <parameter>string</parameter> previously
3028-
encoded with <function>encode</>. Parameter type is same as in <function>encode</>.
3028+
Decode binary data from textual representation in <parameter>string</>.
3029+
Options for <parameter>format</> are same as in <function>encode</>.
30293030
</entry>
30303031
<entry><literal>decode(E'123\\000456', 'escape')</literal></entry>
30313032
<entry><literal>123\000456</literal></entry>
@@ -3036,13 +3037,16 @@
30363037
<indexterm>
30373038
<primary>encode</primary>
30383039
</indexterm>
3039-
<literal><function>encode(<parameter>string</parameter> <type>bytea</type>,
3040-
<parameter>type</parameter> <type>text</type>)</function></literal>
3040+
<literal><function>encode(<parameter>data</parameter> <type>bytea</type>,
3041+
<parameter>format</parameter> <type>text</type>)</function></literal>
30413042
</entry>
30423043
<entry><type>text</type></entry>
30433044
<entry>
3044-
Encode binary string to <acronym>ASCII</acronym>-only representation. Supported
3045-
types are: <literal>base64</>, <literal>hex</>, <literal>escape</>.
3045+
Encode binary data into a textual representation. Supported
3046+
formats are: <literal>base64</>, <literal>hex</>, <literal>escape</>.
3047+
<literal>escape</> converts zero bytes and high-bit-set bytes to
3048+
octal sequences (<literal>\</><replaceable>nnn</>) and
3049+
doubles backslashes.
30463050
</entry>
30473051
<entry><literal>encode(E'123\\000456'::bytea, 'escape')</literal></entry>
30483052
<entry><literal>123\000456</literal></entry>

0 commit comments

Comments
 (0)