From: Tom Lane <tgl@sss.pgh.pa.us>
To: uehara.kazuki@po.ntts.co.jp
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #9541: Result of TRIM function has changed
Date: Wed, 12 Mar 2014 10:29:25 -0400
Message-ID: <11692.1394634565@sss.pgh.pa.us> (raw)
In-Reply-To: <20140312093753.335.3227@wrigleys.postgresql.org>
References: <20140312093753.335.3227@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, uehara.kazuki@po.ntts.co.jp
Subject: Re: BUG #9541: Result of TRIM function has changed
In-Reply-To: <11692.1394634565@sss.pgh.pa.us>
References: <20140312093753.335.3227@wrigleys.postgresql.org> <11692.1394634565@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox