Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WNkA6-0002pE-0u for pgsql-bugs@arkaria.postgresql.org; Wed, 12 Mar 2014 14:29:38 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WNkA5-0007sC-Gs for pgsql-bugs@arkaria.postgresql.org; Wed, 12 Mar 2014 14:29:37 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WNkA4-0007s5-HM for pgsql-bugs@postgresql.org; Wed, 12 Mar 2014 14:29:36 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WNkA1-0001Hw-S4 for pgsql-bugs@postgresql.org; Wed, 12 Mar 2014 14:29:35 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s2CETPnK011693; Wed, 12 Mar 2014 10:29:25 -0400 From: Tom Lane To: uehara.kazuki@po.ntts.co.jp cc: pgsql-bugs@postgresql.org Subject: Re: BUG #9541: Result of TRIM function has changed In-reply-to: <20140312093753.335.3227@wrigleys.postgresql.org> References: <20140312093753.335.3227@wrigleys.postgresql.org> Comments: In-reply-to uehara.kazuki@po.ntts.co.jp message dated "Wed, 12 Mar 2014 09:37:53 -0000" Date: Wed, 12 Mar 2014 10:29:25 -0400 Message-ID: <11692.1394634565@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org uehara.kazuki@po.ntts.co.jp writes: > Depending on the version, the result of the TRIM function is different. I'm not sure that anyone would consider this a supported thing to do: > CREATE FUNCTION LTRIM(CHAR,text) > RETURNS text > AS 'ltrim' > LANGUAGE internal > STRICT; My attitude towards overriding system functions like that is "if it breaks, you get to keep both pieces". (BTW, is there a reason you omitted IMMUTABLE from this?) However, > PostgreSQL9.3.3: > | postgres=# SELECT '|' || TRIM(LEADING 'a' FROM 'abcd'::char(7)) || '|'; > | ?column? > | ---------- > | |bcd | > | (1 row) I get "|bcd|" from this example, in both 9.3 and HEAD branch. I would be surprised to get anything different, because the grammar converts that syntax into "pg_catalog.ltrim(..., ...)" and so your override function cannot be selected as the expansion. At least not if the override function went into schema "public", which would be the default. I suspect that in 9.3.3 you forced the function into the pg_catalog schema, but omitted to do that in the other two examples. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs