Search Postgresql Archives

Re: String trim function - possible bug?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 
My fault, I apologize.  I did realize my mistake while I was at lunch but
had responses before I could post to fix my error.  I can use the
"replace()" function instead.

Thanks,
Woody 

-----Original Message-----
From: pgsql-general-owner@xxxxxxxxxxxxxx
[mailto:pgsql-general-owner@xxxxxxxxxxxxxx] On Behalf Of Stephan Szabo
Sent: Wednesday, June 06, 2007 1:33 PM
To: Woody Woodring
Cc: pgsql-general@xxxxxxxxxxxxxx
Subject: Re: [GENERAL] String trim function - possible bug?


On Wed, 6 Jun 2007, Woody Woodring wrote:

> I am seeing weirdness using the trim function on a string:
>
> This works as expected:
>
> SELECT 'dhct:bn', trim(leading 'dhct:' from 'dhct:bn');  ?column? | 
> ltrim
> ----------+-------
>  dhct:bn  | bn
> (1 row)
>
> However it fails for these cases:
>
> SELECT 'dhct:dn', trim(leading 'dhct:' from 'dhct:dn');  ?column? | 
> ltrim
> ----------+-------
>  dhct:dn  | n
> (1 row)

The 8.2 docs give this as the description in the table:
"Remove the longest string containing only the characters (a space by
default) from the start/end/both ends of the string"

That implies that with characters 'dhct:' the string to remove is 'dhct:d'
because that's the longest leading string made up of those characters.

Maybe a form using something like regexp_replace might work better for you.

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
       message can get through to the mailing list cleanly



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux