bug in translate(text,from,to) ?

From: Wim Kerkhoff <wim(at)netmaster(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: bug in translate(text,from,to) ?
Date: 2000-02-14 18:23:58
Message-ID: 20000214102358.D12207@netmaster.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

[Please Cc me on reply, as my subscription to this list is on the way]

Hi All,

In order to remove all spaces from a varchar field, I've been trying to use the
function translate(text,from,to). However, it translate does not want to
replace the character space with nothing. Instead, it just returns the characters leading up the space, and nothing else.

foo => select translate('12 43', ' ', '');
translate
---------
12
(1 row)

Changing the space ' ' to a character 'a' works though.

Does any one know why this is happening? Or is their an alternate way of doing
this?

A ugly solution to this would be to create a new field in the table that
contains the list of names without spaces, but I want to leave that solution for
last....

Thanks,

Wim Kerkhoff
wim(at)netmaster(dot)com

Browse pgsql-sql by date

  From Date Subject
Next Message Martin Kresse 2000-02-14 18:36:07 "Permission denied" on public view
Previous Message Nicola Cisternino 2000-02-14 16:06:20 ... A LITTLE IDEA TO OPTIMIZE SELECT STATEMENT