Skip to content

Commit 01accb3

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 18bc72e commit 01accb3

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
@@ -1447,7 +1447,8 @@
14471447
<entry>
14481448
Encode binary data into a textual representation. Supported
14491449
formats are: <literal>base64</>, <literal>hex</>, <literal>escape</>.
1450-
<literal>escape</> merely outputs null bytes as <literal>\000</> and
1450+
<literal>escape</> converts zero bytes and high-bit-set bytes to
1451+
octal sequences (<literal>\</><replaceable>nnn</>) and
14511452
doubles backslashes.
14521453
</entry>
14531454
<entry><literal>encode(E'123\\000\\001', 'base64')</literal></entry>
@@ -2753,26 +2754,29 @@
27532754
<row>
27542755
<entry>
27552756
<literal><function>decode(<parameter>string</parameter> <type>text</type>,
2756-
<parameter>type</parameter> <type>text</type>)</function></literal>
2757+
<parameter>format</parameter> <type>text</type>)</function></literal>
27572758
</entry>
27582759
<entry><type>bytea</type></entry>
27592760
<entry>
2760-
Decode binary string from <parameter>string</parameter> previously
2761-
encoded with <function>encode</>. Parameter type is same as in <function>encode</>.
2761+
Decode binary data from textual representation in <parameter>string</>.
2762+
Options for <parameter>format</> are same as in <function>encode</>.
27622763
</entry>
27632764
<entry><literal>decode(E'123\\000456', 'escape')</literal></entry>
27642765
<entry><literal>123\000456</literal></entry>
27652766
</row>
27662767

27672768
<row>
27682769
<entry>
2769-
<literal><function>encode(<parameter>string</parameter> <type>bytea</type>,
2770-
<parameter>type</parameter> <type>text</type>)</function></literal>
2770+
<literal><function>encode(<parameter>data</parameter> <type>bytea</type>,
2771+
<parameter>format</parameter> <type>text</type>)</function></literal>
27712772
</entry>
27722773
<entry><type>text</type></entry>
27732774
<entry>
2774-
Encode binary string to <acronym>ASCII</acronym>-only representation. Supported
2775-
types are: <literal>base64</>, <literal>hex</>, <literal>escape</>.
2775+
Encode binary data into a textual representation. Supported
2776+
formats are: <literal>base64</>, <literal>hex</>, <literal>escape</>.
2777+
<literal>escape</> converts zero bytes and high-bit-set bytes to
2778+
octal sequences (<literal>\</><replaceable>nnn</>) and
2779+
doubles backslashes.
27762780
</entry>
27772781
<entry><literal>encode(E'123\\000456'::bytea, 'escape')</literal></entry>
27782782
<entry><literal>123\000456</literal></entry>

0 commit comments

Comments
 (0)