Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 9371C47619B for ; Wed, 22 Jan 2003 02:41:24 -0500 (EST) Received: from mail02.up.edu.ph (unknown [210.14.43.1]) by postgresql.org (Postfix) with SMTP id F30FD476184 for ; Wed, 22 Jan 2003 02:41:22 -0500 (EST) Received: (qmail 9870 invoked by uid 504); 22 Jan 2003 08:13:22 -0000 Received: from ryanne.cruz@up.edu.ph by web2 with qmail-scanner-1.01 (update: v4243 15 Jan 2003. Clean. Processed in 0.825047 secs); 22 Jan 2003 08:13:22 -0000 Received: from unknown (HELO b01.mail.up.edu.ph) (10.16.3.1) by 10.16.3.144 with SMTP; 22 Jan 2003 08:13:21 -0000 Received: (qmail 16299 invoked by uid 504); 22 Jan 2003 07:44:57 -0000 Received: from ryanne.cruz@up.edu.ph by b01 with qmail-scanner-1.01 (update: v4243 15 Jan 2003. Clean. Processed in 0.440519 secs); 22 Jan 2003 07:44:57 -0000 Received: from unknown (HELO localhost) ([10.16.3.5]) (envelope-sender ) by 10.16.3.1 (qmail-ldap-1.03) with SMTP for ; 22 Jan 2003 07:44:56 -0000 Received: from 10.33.187.83 ( [10.33.187.83]) as user rocruz1@b04.mail.up.edu.ph by mail.up.edu.ph with HTTP; Wed, 22 Jan 2003 15:55:14 +0800 Message-ID: <1043222114.3e2e4e6232dcd@mail.up.edu.ph> Date: Wed, 22 Jan 2003 15:55:14 +0800 From: ryanne cruz To: pgsql-php@postgresql.org, Andrew McMillan Subject: Re: rtrim References: <1043216728.3e2e39585c6f3@mail.up.edu.ph> <1043220702.3118.189.camel@kant.mcmillan.net.nz> In-Reply-To: <1043220702.3118.189.camel@kant.mcmillan.net.nz> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.1 X-Originating-IP: 10.33.187.83 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/41 X-Sequence-Number: 1786 in both my of my tables, the original and the table where i will insert the column without the ", USA", the type of the columns are character varying. is that the same with varchar? Quoting Andrew McMillan : > On Wed, 2003-01-22 at 19:25, ryanne cruz wrote: > > hi list. > > > > if there's anyone here who's familiar with teh rtrim function, please i > need > > help. > > It depends on the datatypes in use. > > If you use a type like "CHAR(32)" it will always be right-padded with > spaces. Whereas if you use a type like "TEXT" or "VARCHAR(32)" it will > be stored as you enter it (it may still have some trailling spaces. > > Now, when you use the rtrim() function, but insert the result into a > CHAR(N) column, all those spaces will just be stuck straight back on > again. This is likely to be what is happening in your case. > > Regards, > Andrew. > > > > i have a table that has a column in it that has data in this format: > > > > California, USA > > Nevada, USA > > . > > . > > . > > > > when i use rtrim to erase the ", USA" part, it only sometimes work. a > sample > > result would be: > > > > California > > Nevad > > > > my query statement is: > > update table set name=rtrim(name,', USA'); > > > > why is it that it only works sometimes? > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 5: Have you checked our extensive FAQ? > > > > http://www.postgresql.org/users-lounge/docs/faq.html > -- > --------------------------------------------------------------------- > Andrew @ Catalyst .Net.NZ Ltd, PO Box 11-053, Manners St, Wellington > WEB: http://catalyst.net.nz/ PHYS: Level 2, 150-154 Willis St > DDI: +64(4)916-7201 MOB: +64(21)635-694 OFFICE: +64(4)499-2267 > Survey for nothing with http://survey.net.nz/ > --------------------------------------------------------------------- > >