The following bug has been logged on the website:
Bug reference: 9541
Logged by: Kazuki Uehara
Email address: uehara.kazuki@po.ntts.co.jp
PostgreSQL version: 9.3.3
Operating system: CentOS release 5.6
Description:
Depending on the version, the result of the TRIM function is different.
I did the following steps.
1. Change the setting of search_path.
---------------------------------------------
search_path='test,pg_catalog,"$user",public'
---------------------------------------------
2. Run the following query.
-------------------------------------------
CREATE FUNCTION LTRIM(CHAR,text)
RETURNS text
AS 'ltrim'
LANGUAGE internal
STRICT;
SELECT '|' || TRIM(LEADING 'a' FROM 'abcd'::char(7)) || '|';
--------------------------------------------
Execution result of each version
PostgreSQL9.3.1
| postgres=# SELECT '|' || TRIM(LEADING 'a' FROM 'abcd'::char(7)) || '|';
| ?column?
| ----------
| |bcd|
| (1 row)
PostgreSQL9.3.2ï¼
| postgres=# SELECT '|' || TRIM(LEADING 'a' FROM 'abcd'::char(7)) || '|';
| ?column?
| ----------
| |bcd|
| (1 row)
PostgreSQL9.3.3ï¼
| postgres=# SELECT '|' || TRIM(LEADING 'a' FROM 'abcd'::char(7)) || '|';
| ?column?
| ----------
| |bcd |
| (1 row)
Thank you very much.