Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e82bcba

Browse files
committed
Here's a doc patch for the new string functions recently committed --
replace, split, and to_hex. The patch also moves encode and decode into alphabetical order (since everything else in the table was). Joe Conway
1 parent ab5fe2a commit e82bcba

File tree

1 file changed

+64
-29
lines changed

1 file changed

+64
-29
lines changed

doc/src/sgml/func.sgml

Lines changed: 64 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.119 2002/09/01 23:26:05 momjian Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.120 2002/09/02 05:53:23 momjian Exp $
33
PostgreSQL documentation
44
-->
55

@@ -1727,6 +1727,34 @@ PostgreSQL documentation
17271727
<entry><literal>text_in_unicode</literal> represented in ISO 8859-1</entry>
17281728
</row>
17291729

1730+
<row>
1731+
<entry>
1732+
<function>decode</function>(<parameter>string</parameter> <type>text</type>,
1733+
<parameter>type</parameter> <type>text</type>)
1734+
</entry>
1735+
<entry><type>bytea</type></entry>
1736+
<entry>
1737+
Decodes binary data from <parameter>string</parameter> previously
1738+
encoded with encode(). Parameter type is same as in encode().
1739+
</entry>
1740+
<entry><literal>decode('MTIzAAE=', 'base64')</literal></entry>
1741+
<entry><literal>123\000\001</literal></entry>
1742+
</row>
1743+
1744+
<row>
1745+
<entry>
1746+
<function>encode</function>(<parameter>data</parameter> <type>bytea</type>,
1747+
<parameter>type</parameter> <type>text</type>)
1748+
</entry>
1749+
<entry><type>text</type></entry>
1750+
<entry>
1751+
Encodes binary data to <acronym>ASCII</acronym>-only representation. Supported
1752+
types are: 'base64', 'hex', 'escape'.
1753+
</entry>
1754+
<entry><literal>encode('123\\000\\001', 'base64')</literal></entry>
1755+
<entry><literal>MTIzAAE=</literal></entry>
1756+
</row>
1757+
17301758
<row>
17311759
<entry><function>initcap</function>(<type>text</type>)</entry>
17321760
<entry><type>text</type></entry>
@@ -1828,6 +1856,18 @@ PostgreSQL documentation
18281856
<entry><literal>PgPgPgPg</literal></entry>
18291857
</row>
18301858

1859+
<row>
1860+
<entry><function>replace</function>(<parameter>string</parameter> <type>text</type>,
1861+
<parameter>from</parameter> <type>text</type>,
1862+
<parameter>to</parameter> <type>text</type>)</entry>
1863+
<entry><type>text</type></entry>
1864+
<entry>Replace all occurrences in <parameter>string</parameter> of substring
1865+
<parameter>from</parameter> with substring <parameter>to</parameter>
1866+
</entry>
1867+
<entry><literal>replace('abcdefabcdef', 'cd', 'XX')</literal></entry>
1868+
<entry><literal>abXXefabXXef</literal></entry>
1869+
</row>
1870+
18311871
<row>
18321872
<entry>
18331873
<function>rpad</function>(<parameter>string</parameter> <type>text</type>,
@@ -1858,6 +1898,18 @@ PostgreSQL documentation
18581898
<entry><literal>trim</literal></entry>
18591899
</row>
18601900

1901+
<row>
1902+
<entry><function>split</function>(<parameter>string</parameter> <type>text</type>,
1903+
<parameter>delimiter</parameter> <type>text</type>,
1904+
<parameter>column</parameter> <type>integer</type>)</entry>
1905+
<entry><type>text</type></entry>
1906+
<entry>Split <parameter>string</parameter> on <parameter>delimiter</parameter>
1907+
returning the resulting (one based) <parameter>column</parameter> number.
1908+
</entry>
1909+
<entry><literal>split('abc~@~def~@~ghi','~@~',2)</literal></entry>
1910+
<entry><literal>def</literal></entry>
1911+
</row>
1912+
18611913
<row>
18621914
<entry><function>strpos</function>(<parameter>string</parameter>, <parameter>substring</parameter>)</entry>
18631915
<entry><type>text</type></entry>
@@ -1891,6 +1943,17 @@ PostgreSQL documentation
18911943
<entry><literal>Karel</literal></entry>
18921944
</row>
18931945

1946+
<row>
1947+
<entry><function>to_hex</function>(<parameter>number</parameter> <type>integer</type>
1948+
or <type>bigint</type>)</entry>
1949+
<entry><type>text</type></entry>
1950+
<entry>Convert <parameter>number</parameter> to its equivalent hexadecimal
1951+
representation.
1952+
</entry>
1953+
<entry><literal>to_hex(9223372036854775807::bigint)</literal></entry>
1954+
<entry><literal>7fffffffffffffff</literal></entry>
1955+
</row>
1956+
18941957
<row>
18951958
<entry>
18961959
<function>translate</function>(<parameter>string</parameter>
@@ -1909,34 +1972,6 @@ PostgreSQL documentation
19091972
<entry><literal>a23x5</literal></entry>
19101973
</row>
19111974

1912-
<row>
1913-
<entry>
1914-
<function>encode</function>(<parameter>data</parameter> <type>bytea</type>,
1915-
<parameter>type</parameter> <type>text</type>)
1916-
</entry>
1917-
<entry><type>text</type></entry>
1918-
<entry>
1919-
Encodes binary data to <acronym>ASCII</acronym>-only representation. Supported
1920-
types are: 'base64', 'hex', 'escape'.
1921-
</entry>
1922-
<entry><literal>encode('123\\000\\001', 'base64')</literal></entry>
1923-
<entry><literal>MTIzAAE=</literal></entry>
1924-
</row>
1925-
1926-
<row>
1927-
<entry>
1928-
<function>decode</function>(<parameter>string</parameter> <type>text</type>,
1929-
<parameter>type</parameter> <type>text</type>)
1930-
</entry>
1931-
<entry><type>bytea</type></entry>
1932-
<entry>
1933-
Decodes binary data from <parameter>string</parameter> previously
1934-
encoded with encode(). Parameter type is same as in encode().
1935-
</entry>
1936-
<entry><literal>decode('MTIzAAE=', 'base64')</literal></entry>
1937-
<entry><literal>123\000\001</literal></entry>
1938-
</row>
1939-
19401975
</tbody>
19411976
</tgroup>
19421977
</table>

0 commit comments

Comments
 (0)