Thread: description of translate()

description of translate()

From
Josh Kupershmidt
Date:
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

Attachment

Re: description of translate()

From
Alvaro Herrera
Date:
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