From: Tom Lane <tgl@sss.pgh.pa.us>
To: Joe Conway <mail@joeconway.com>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: dominik.kosiorek@infobright.com <dominik.kosiorek@infobright.com>
Cc: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: BUG #13934: wrong result of split_part with char value
Date: Tue, 09 Feb 2016 10:55:40 -0500
Message-ID: <9241.1455033340@sss.pgh.pa.us> (raw)
In-Reply-To: <56BA05C4.7010004@joeconway.com>
References: <20160208151107.2662.82302@wrigleys.postgresql.org>
<CAKFQuwaqOhZvK1rndtTzJyFjsGEGVXrpceYF49bwX3mC0ADuVQ@mail.gmail.com>
<56BA05C4.7010004@joeconway.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
Joe Conway <mail@joeconway.com> writes:
> In other words, when you insert ' ' into string1postgres.a3pattern,
> which is defined as char(15), the single space is trimmed leaving an
> empty string:
> test=# select '***' || a3pattern || '!!!' from string1postgres;
> ?column?
> ----------
> ***!!!
> (1 row)
Actually, I believe the space-trimming happens when the char(n) value
is coerced to type text in preparation for passing it to the || operator
(which takes text). Since trailing spaces are considered insignificant
in char(n), whereas they definitely are significant in text, this is a
reasonable thing to do, at least in some contexts.
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, mail@joeconway.com, david.g.johnston@gmail.com, dominik.kosiorek@infobright.com
Subject: Re: BUG #13934: wrong result of split_part with char value
In-Reply-To: <9241.1455033340@sss.pgh.pa.us>
References: <20160208151107.2662.82302@wrigleys.postgresql.org> <CAKFQuwaqOhZvK1rndtTzJyFjsGEGVXrpceYF49bwX3mC0ADuVQ@mail.gmail.com> <56BA05C4.7010004@joeconway.com> <9241.1455033340@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