Re: new string functions doc

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: new string functions doc
Date: 2002-09-02 05:53:01
Message-ID: 200209020553.g825r1H15651@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


Patch applied. Thanks.

---------------------------------------------------------------------------

Joe Conway wrote:
> 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).
>
> Please apply if there are no objections.
>
> Thanks,
>
> Joe

> Index: doc/src/sgml/func.sgml
> ===================================================================
> RCS file: /opt/src/cvs/pgsql-server/doc/src/sgml/func.sgml,v
> retrieving revision 1.118
> diff -c -r1.118 func.sgml
> *** doc/src/sgml/func.sgml 29 Aug 2002 05:17:55 -0000 1.118
> --- doc/src/sgml/func.sgml 31 Aug 2002 23:55:49 -0000
> ***************
> *** 1728,1733 ****
> --- 1728,1761 ----
> </row>
>
> <row>
> + <entry>
> + <function>decode</function>(<parameter>string</parameter> <type>text</type>,
> + <parameter>type</parameter> <type>text</type>)
> + </entry>
> + <entry><type>bytea</type></entry>
> + <entry>
> + Decodes binary data from <parameter>string</parameter> previously
> + encoded with encode(). Parameter type is same as in encode().
> + </entry>
> + <entry><literal>decode('MTIzAAE=', 'base64')</literal></entry>
> + <entry><literal>123\000\001</literal></entry>
> + </row>
> +
> + <row>
> + <entry>
> + <function>encode</function>(<parameter>data</parameter> <type>bytea</type>,
> + <parameter>type</parameter> <type>text</type>)
> + </entry>
> + <entry><type>text</type></entry>
> + <entry>
> + Encodes binary data to <acronym>ASCII</acronym>-only representation. Supported
> + types are: 'base64', 'hex', 'escape'.
> + </entry>
> + <entry><literal>encode('123\\000\\001', 'base64')</literal></entry>
> + <entry><literal>MTIzAAE=</literal></entry>
> + </row>
> +
> + <row>
> <entry><function>initcap</function>(<type>text</type>)</entry>
> <entry><type>text</type></entry>
> <entry>Converts first letter of each word (whitespace separated) to upper case.</entry>
> ***************
> *** 1829,1834 ****
> --- 1857,1874 ----
> </row>
>
> <row>
> + <entry><function>replace</function>(<parameter>string</parameter> <type>text</type>,
> + <parameter>from</parameter> <type>text</type>,
> + <parameter>to</parameter> <type>text</type>)</entry>
> + <entry><type>text</type></entry>
> + <entry>Replace all occurrences in <parameter>string</parameter> of substring
> + <parameter>from</parameter> with substring <parameter>to</parameter>
> + </entry>
> + <entry><literal>replace('abcdefabcdef', 'cd', 'XX')</literal></entry>
> + <entry><literal>abXXefabXXef</literal></entry>
> + </row>
> +
> + <row>
> <entry>
> <function>rpad</function>(<parameter>string</parameter> <type>text</type>,
> <parameter>length</parameter> <type>integer</type>
> ***************
> *** 1859,1864 ****
> --- 1899,1916 ----
> </row>
>
> <row>
> + <entry><function>split</function>(<parameter>string</parameter> <type>text</type>,
> + <parameter>delimiter</parameter> <type>text</type>,
> + <parameter>column</parameter> <type>integer</type>)</entry>
> + <entry><type>text</type></entry>
> + <entry>Split <parameter>string</parameter> on <parameter>delimiter</parameter>
> + returning the resulting (one based) <parameter>column</parameter> number.
> + </entry>
> + <entry><literal>split('abc~(at)~def~@~ghi','~(at)~',2)</literal></entry>
> + <entry><literal>def</literal></entry>
> + </row>
> +
> + <row>
> <entry><function>strpos</function>(<parameter>string</parameter>, <parameter>substring</parameter>)</entry>
> <entry><type>text</type></entry>
> <entry>
> ***************
> *** 1892,1897 ****
> --- 1944,1960 ----
> </row>
>
> <row>
> + <entry><function>to_hex</function>(<parameter>number</parameter> <type>integer</type>
> + or <type>bigint</type>)</entry>
> + <entry><type>text</type></entry>
> + <entry>Convert <parameter>number</parameter> to its equivalent hexadecimal
> + representation.
> + </entry>
> + <entry><literal>to_hex(9223372036854775807::bigint)</literal></entry>
> + <entry><literal>7fffffffffffffff</literal></entry>
> + </row>
> +
> + <row>
> <entry>
> <function>translate</function>(<parameter>string</parameter>
> <type>text</type>,
> ***************
> *** 1909,1942 ****
> <entry><literal>a23x5</literal></entry>
> </row>
>
> - <row>
> - <entry>
> - <function>encode</function>(<parameter>data</parameter> <type>bytea</type>,
> - <parameter>type</parameter> <type>text</type>)
> - </entry>
> - <entry><type>text</type></entry>
> - <entry>
> - Encodes binary data to <acronym>ASCII</acronym>-only representation. Supported
> - types are: 'base64', 'hex', 'escape'.
> - </entry>
> - <entry><literal>encode('123\\000\\001', 'base64')</literal></entry>
> - <entry><literal>MTIzAAE=</literal></entry>
> - </row>
> -
> - <row>
> - <entry>
> - <function>decode</function>(<parameter>string</parameter> <type>text</type>,
> - <parameter>type</parameter> <type>text</type>)
> - </entry>
> - <entry><type>bytea</type></entry>
> - <entry>
> - Decodes binary data from <parameter>string</parameter> previously
> - encoded with encode(). Parameter type is same as in encode().
> - </entry>
> - <entry><literal>decode('MTIzAAE=', 'base64')</literal></entry>
> - <entry><literal>123\000\001</literal></entry>
> - </row>
> -
> </tbody>
> </tgroup>
> </table>
> --- 1972,1977 ----

>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2002-09-02 05:54:20 Re: bytea operator bugs (was Re: [GENERAL] BYTEA, indexes
Previous Message Bruce Momjian 2002-09-02 05:43:53 Re: contrib/tablefunc update