|
1427 | 1427 | <row>
|
1428 | 1428 | <entry>
|
1429 | 1429 | <literal><function>decode(<parameter>string</parameter> <type>text</type>,
|
1430 |
| - <parameter>type</parameter> <type>text</type>)</function></literal> |
| 1430 | + <parameter>format</parameter> <type>text</type>)</function></literal> |
1431 | 1431 | </entry>
|
1432 | 1432 | <entry><type>bytea</type></entry>
|
1433 | 1433 | <entry>
|
1434 |
| - Decode binary data from <parameter>string</parameter> previously |
1435 |
| - encoded with <function>encode</>. Parameter type is same as in <function>encode</>. |
| 1434 | + Decode binary data from textual representation in <parameter>string</>. |
| 1435 | + Options for <parameter>format</> are same as in <function>encode</>. |
1436 | 1436 | </entry>
|
1437 | 1437 | <entry><literal>decode('MTIzAAE=', 'base64')</literal></entry>
|
1438 |
| - <entry><literal>123\000\001</literal></entry> |
| 1438 | + <entry><literal>x3132330001</literal></entry> |
1439 | 1439 | </row>
|
1440 | 1440 |
|
1441 | 1441 | <row>
|
1442 | 1442 | <entry>
|
1443 | 1443 | <literal><function>encode(<parameter>data</parameter> <type>bytea</type>,
|
1444 |
| - <parameter>type</parameter> <type>text</type>)</function></literal> |
| 1444 | + <parameter>format</parameter> <type>text</type>)</function></literal> |
1445 | 1445 | </entry>
|
1446 | 1446 | <entry><type>text</type></entry>
|
1447 | 1447 | <entry>
|
1448 |
| - Encode binary data to different representation. Supported |
1449 |
| - types are: <literal>base64</>, <literal>hex</>, <literal>escape</>. |
1450 |
| - <literal>Escape</> merely outputs null bytes as <literal>\000</> and |
| 1448 | + Encode binary data into a textual representation. Supported |
| 1449 | + formats are: <literal>base64</>, <literal>hex</>, <literal>escape</>. |
| 1450 | + <literal>escape</> merely outputs null bytes as <literal>\000</> and |
1451 | 1451 | doubles backslashes.
|
1452 | 1452 | </entry>
|
1453 | 1453 | <entry><literal>encode(E'123\\000\\001', 'base64')</literal></entry>
|
|
1570 | 1570 | <function>quote_nullable</function> is often more suitable.
|
1571 | 1571 | See also <xref linkend="plpgsql-quote-literal-example">.
|
1572 | 1572 | </entry>
|
1573 |
| - <entry><literal>quote_literal('O\'Reilly')</literal></entry> |
| 1573 | + <entry><literal>quote_literal(E'O\'Reilly')</literal></entry> |
1574 | 1574 | <entry><literal>'O''Reilly'</literal></entry>
|
1575 | 1575 | </row>
|
1576 | 1576 |
|
|
2620 | 2620 | (see <xref linkend="functions-binarystring-other">).
|
2621 | 2621 | </para>
|
2622 | 2622 |
|
| 2623 | + <note> |
| 2624 | + <para> |
| 2625 | + The sample results shown on this page assume that the server parameter |
| 2626 | + <link linkend="guc-bytea-output"><varname>bytea_output</></link> is set |
| 2627 | + to <literal>escape</literal> (the traditional PostgreSQL format). |
| 2628 | + </para> |
| 2629 | + </note> |
| 2630 | + |
2623 | 2631 | <table id="functions-binarystring-sql">
|
2624 | 2632 | <title><acronym>SQL</acronym> Binary String Functions and Operators</title>
|
2625 | 2633 | <tgroup cols="5">
|
|
0 commit comments