Search Postgresql Archives

String trim function - possible bug?

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

 



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)
 
SELECT 'dhct:cn', trim(leading 'dhct:' from 'dhct:cn');
 ?column? | ltrim
----------+-------
 dhct:cn  | n
(1 row)

The second case truncates an extra character (which is unwanted or
unexpected).

It fails for both 8.1.4 and 8.2.3.  It seems if the first character after
the 'dhct:' is a 'd' or a 'c' it truncates it as well.  I have not tested
every letter of the alphabet yet.

Any suggestions?

Thanks,
Woody

----------------------------------------
iGLASS Networks
211-A S. Salem St
Apex NC 27502
(919) 387-3550 x813
www.iglass.net



[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