|
1482 | 1482 | <primary>decode</primary>
|
1483 | 1483 | </indexterm>
|
1484 | 1484 | <literal><function>decode(<parameter>string</parameter> <type>text</type>,
|
1485 |
| - <parameter>type</parameter> <type>text</type>)</function></literal> |
| 1485 | + <parameter>format</parameter> <type>text</type>)</function></literal> |
1486 | 1486 | </entry>
|
1487 | 1487 | <entry><type>bytea</type></entry>
|
1488 | 1488 | <entry>
|
1489 |
| - Decode binary data from <parameter>string</parameter> previously |
1490 |
| - encoded with <function>encode</>. Parameter type is same as in <function>encode</>. |
| 1489 | + Decode binary data from textual representation in <parameter>string</>. |
| 1490 | + Options for <parameter>format</> are same as in <function>encode</>. |
1491 | 1491 | </entry>
|
1492 | 1492 | <entry><literal>decode('MTIzAAE=', 'base64')</literal></entry>
|
1493 |
| - <entry><literal>123\000\001</literal></entry> |
| 1493 | + <entry><literal>\x3132330001</literal></entry> |
1494 | 1494 | </row>
|
1495 | 1495 |
|
1496 | 1496 | <row>
|
|
1499 | 1499 | <primary>encode</primary>
|
1500 | 1500 | </indexterm>
|
1501 | 1501 | <literal><function>encode(<parameter>data</parameter> <type>bytea</type>,
|
1502 |
| - <parameter>type</parameter> <type>text</type>)</function></literal> |
| 1502 | + <parameter>format</parameter> <type>text</type>)</function></literal> |
1503 | 1503 | </entry>
|
1504 | 1504 | <entry><type>text</type></entry>
|
1505 | 1505 | <entry>
|
1506 |
| - Encode binary data to different representation. Supported |
1507 |
| - types are: <literal>base64</>, <literal>hex</>, <literal>escape</>. |
1508 |
| - <literal>Escape</> merely outputs null bytes as <literal>\000</> and |
| 1506 | + Encode binary data into a textual representation. Supported |
| 1507 | + formats are: <literal>base64</>, <literal>hex</>, <literal>escape</>. |
| 1508 | + <literal>escape</> merely outputs null bytes as <literal>\000</> and |
1509 | 1509 | doubles backslashes.
|
1510 | 1510 | </entry>
|
1511 | 1511 | <entry><literal>encode(E'123\\000\\001', 'base64')</literal></entry>
|
|
1707 | 1707 | <function>quote_nullable</function> is often more suitable.
|
1708 | 1708 | See also <xref linkend="plpgsql-quote-literal-example">.
|
1709 | 1709 | </entry>
|
1710 |
| - <entry><literal>quote_literal('O\'Reilly')</literal></entry> |
| 1710 | + <entry><literal>quote_literal(E'O\'Reilly')</literal></entry> |
1711 | 1711 | <entry><literal>'O''Reilly'</literal></entry>
|
1712 | 1712 | </row>
|
1713 | 1713 |
|
|
2859 | 2859 | (see <xref linkend="functions-binarystring-other">).
|
2860 | 2860 | </para>
|
2861 | 2861 |
|
| 2862 | + <note> |
| 2863 | + <para> |
| 2864 | + The sample results shown on this page assume that the server parameter |
| 2865 | + <link linkend="guc-bytea-output"><varname>bytea_output</></link> is set |
| 2866 | + to <literal>escape</literal> (the traditional PostgreSQL format). |
| 2867 | + </para> |
| 2868 | + </note> |
| 2869 | + |
2862 | 2870 | <table id="functions-binarystring-sql">
|
2863 | 2871 | <title><acronym>SQL</acronym> Binary String Functions and Operators</title>
|
2864 | 2872 | <tgroup cols="5">
|
|
0 commit comments