Please send a carbon copy of replies to me, as I am not a subscriber of any postgresql mailing list.
Hi folks, I noticed that I can use the string function "translate" to remove unwanted characters from strings, this way: translate(tablefield, '-_. ', ''); This will remove all hifens, underscores, dots and spaces. However, reading the postgres-user-guide, I noticed that this is a undocumented feature, so I read the source codes to see if this was desired or just a bug. In the function code of translate, I can read in the comments that removing characters without correspondence was what the developer desired. Then this should be add to docs, so other people whose need this can also use it. Below is a patch for it. Thanks for postgresql, it is a really great software! Bye, Pedro -- .''`. Pedro Zorzenon Neto <[EMAIL PROTECTED]> : :' : Debian GNU/Linux | GNU/Hurd: <http://www.debian.org> `. `'` Debian BR: <http://debian-br.cipsga.org.br> `- Be Happy! Be FREE! --- doc/src/sgml/func.sgml.orig Wed Sep 24 19:56:38 2003 +++ doc/src/sgml/func.sgml Wed Sep 24 19:58:30 2003 @@ -1307,7 +1307,9 @@ 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. + set. If <parameter>from</parameter> is longer than + <parameter>to</parameter>, occurrences of the extra characters + in <parameter>from</parameter> are deleted. </entry> <entry><literal>translate('12345', '14', 'ax')</literal></entry> <entry><literal>a23x5</literal></entry> ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match