pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Wim Kerkhoff <wim@netmaster.com>
To: pgsql-sql@postgresql.org
Subject: bug in translate(text,from,to) ?
Date: Mon, 14 Feb 2000 10:23:58 -0800
Message-ID: <20000214102358.D12207@netmaster.com> (raw)

[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@netmaster.com




Message-ID: <20000214102358.D12207@netmaster.com>
Permalink:  ../20000214102358.D12207@netmaster.com/
Also on:    postgresql.org/message-id/20000214102358.D12207@netmaster.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: wim@netmaster.com
  Subject: Re: bug in translate(text,from,to) ?
  In-Reply-To: <20000214102358.D12207@netmaster.com>
  References: <20000214102358.D12207@netmaster.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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