pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
description of translate()
2+ messages / 2 participants
[nested] [flat]

* description of translate()
@ 2010-10-14 00:50  Josh Kupershmidt <schmiddy@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Josh Kupershmidt @ 2010-10-14 00:50 UTC (permalink / raw)
  To: pgsql-docs

Hi all,

I noticed that the existing description of the string translate()
function <http://www.postgresql.org/docs/current/static/functions-string.html#FUNCTIONS-STRING-OTHER;
currently has a description of:

  Any character in string that matches a character in the from set is
replaced by the corresponding character in the to set

This description leaves off the other half of translate()'s
capability, namely stripping unwanted characters entirely. The comment
for the translate() in oracle_compat.c is helpful here, saying:

  If from is longer than to, occurrences of the extra characters in
from are deleted.

Attached is a patch to update the doc page based on this comment's wording.

Josh

Attachments:

func.sgml.patch (application/octet-stream, 1.1K) download diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 5d422af..eaeacef 100644 *** a/doc/src/sgml/func.sgml --- b/doc/src/sgml/func.sgml *************** *** 1866,1872 **** Any character in <parameter>string</parameter> that matches a character in the <parameter>from</parameter> set is replaced by the corresponding character in the <parameter>to</parameter> ! set </entry> <entry><literal>translate('12345', '14', 'ax')</literal></entry> <entry><literal>a23x5</literal></entry> --- 1866,1874 ---- Any character in <parameter>string</parameter> that matches a character in the <parameter>from</parameter> set is replaced by the corresponding character in the <parameter>to</parameter> ! set. If <parameter>from</parameter> is longer than ! <parameter>to</parameter>, occurrences of the extra characters in ! <parameter>from</parameter> are removed. </entry> <entry><literal>translate('12345', '14', 'ax')</literal></entry> <entry><literal>a23x5</literal></entry>
^ permalink raw reply [nested|flat] 2+ messages in thread

* Re: description of translate()
@ 2010-10-16 04:30  Alvaro Herrera <alvherre@commandprompt.com>
  parent: Josh Kupershmidt <schmiddy@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Alvaro Herrera @ 2010-10-16 04:30 UTC (permalink / raw)
  To: Josh Kupershmidt <schmiddy@gmail.com>; +Cc: pgsql-docs

Excerpts from Josh Kupershmidt's message of mié oct 13 21:50:40 -0300 2010:

> This description leaves off the other half of translate()'s
> capability, namely stripping unwanted characters entirely. The comment
> for the translate() in oracle_compat.c is helpful here, saying:

Agreed.  I applied your patch and also touched the example slightly to
illustrate this.

I didn't backpatch this; probably not worth the trouble.

Thanks.

-- 
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2010-10-16 04:30 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-10-14 00:50 description of translate() Josh Kupershmidt <schmiddy@gmail.com>
2010-10-16 04:30 ` Alvaro Herrera <alvherre@commandprompt.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox