String trim function - possible bug?

From: "Woody Woodring" <george(dot)woodring(at)iglass(dot)net>
To: <pgsql-general(at)postgresql(dot)org>
Subject: String trim function - possible bug?
Date: 2007-06-06 16:21:33
Message-ID: 097301c7a856$bf746a80$80b1a8c0@istructure.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2007-06-06 16:34:00 Re: plperl and/or insert trigger problem
Previous Message lawpoop 2007-06-06 16:19:12 using subselects