Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc59b8ba

Browse files
committed
Update examples for string-related functions.
In the example for decode(), show the bytea result in hex format,since that's now the default. Use an E'' string in the example forquote_literal(), so that it works regardless of thestandard_conforming_strings setting. On the functions-for-binary-stringspage, leave the examples as-is for readability, but add a note pointing outthat they are shown in escape format. Per comments from Thom Brown.Also, improve the description for encode() and decode() a tad.Backpatch to 9.0, where bytea_output was introduced.
1 parent997d5b4 commitc59b8ba

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

‎doc/src/sgml/func.sgml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,15 +1482,15 @@
14821482
<primary>decode</primary>
14831483
</indexterm>
14841484
<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>
14861486
</entry>
14871487
<entry><type>bytea</type></entry>
14881488
<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 fromtextual representation in<parameter>string</>.
1490+
Options for <parameter>format</> are same as in <function>encode</>.
14911491
</entry>
14921492
<entry><literal>decode('MTIzAAE=', 'base64')</literal></entry>
1493-
<entry><literal>123\000\001</literal></entry>
1493+
<entry><literal>\x3132330001</literal></entry>
14941494
</row>
14951495

14961496
<row>
@@ -1499,13 +1499,13 @@
14991499
<primary>encode</primary>
15001500
</indexterm>
15011501
<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>
15031503
</entry>
15041504
<entry><type>text</type></entry>
15051505
<entry>
1506-
Encode binary datato 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 datainto a textual representation. Supported
1507+
formats are: <literal>base64</>, <literal>hex</>, <literal>escape</>.
1508+
<literal>escape</> merely outputs null bytes as <literal>\000</> and
15091509
doubles backslashes.
15101510
</entry>
15111511
<entry><literal>encode(E'123\\000\\001', 'base64')</literal></entry>
@@ -1707,7 +1707,7 @@
17071707
<function>quote_nullable</function> is often more suitable.
17081708
See also <xref linkend="plpgsql-quote-literal-example">.
17091709
</entry>
1710-
<entry><literal>quote_literal('O\'Reilly')</literal></entry>
1710+
<entry><literal>quote_literal(E'O\'Reilly')</literal></entry>
17111711
<entry><literal>'O''Reilly'</literal></entry>
17121712
</row>
17131713

@@ -2859,6 +2859,14 @@
28592859
(see <xref linkend="functions-binarystring-other">).
28602860
</para>
28612861

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+
28622870
<table id="functions-binarystring-sql">
28632871
<title><acronym>SQL</acronym> Binary String Functions and Operators</title>
28642872
<tgroup cols="5">

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp