Re: rtrim

From: ryanne cruz <ryanne(dot)cruz(at)up(dot)edu(dot)ph>
To: pgsql-php(at)postgresql(dot)org, Andrew McMillan <andrew(at)catalyst(dot)net(dot)nz>
Subject: Re: rtrim
Date: 2003-01-22 07:55:14
Message-ID: 1043222114.3e2e4e6232dcd@mail.up.edu.ph
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

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 <andrew(at)catalyst(dot)net(dot)nz>:

> 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/
> ---------------------------------------------------------------------
>
>

In response to

  • Re: rtrim at 2003-01-22 07:31:42 from Andrew McMillan

Browse pgsql-php by date

  From Date Subject
Next Message ryanne cruz 2003-01-22 07:57:29 Re: empty
Previous Message Andrew McMillan 2003-01-22 07:36:59 Re: empty