From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Joe Conway <mail(at)joeconway(dot)com>, "dominik(dot)kosiorek(at)infobright(dot)com" <dominik(dot)kosiorek(at)infobright(dot)com>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org> |
Subject: | Re: BUG #13934: wrong result of split_part with char value |
Date: | 2016-02-09 16:14:24 |
Message-ID: | CAKFQuwZMTjLNuxrDfYacoqsMcO1EQVN+cCOB0C2LBTGfhNMfLw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Tue, Feb 9, 2016 at 8:55 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Joe Conway <mail(at)joeconway(dot)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.
>
>
And in the OP:
select split_part(a2,a3pattern,a4field) from string1postgres;
split_part likewise takes text, not char, and so an implicit conversion
and trimming takes place.
David j.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2016-02-09 17:15:54 | Re: BUG #13938: CAST error on Index "function must be immutable" |
Previous Message | Tom Lane | 2016-02-09 15:55:40 | Re: BUG #13934: wrong result of split_part with char value |