Re: BUG #13934: wrong result of split_part with char value
От | David G. Johnston |
---|---|
Тема | Re: BUG #13934: wrong result of split_part with char value |
Дата | |
Msg-id | CAKFQuwZMTjLNuxrDfYacoqsMcO1EQVN+cCOB0C2LBTGfhNMfLw@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: BUG #13934: wrong result of split_part with char value (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-bugs |
On Tue, Feb 9, 2016 at 8:55 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote: > 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=3D# 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. > > =E2=80=8BAnd in the OP: =E2=80=8B select split_part(a2,a3pattern,a4field) from string1postgres; =E2=80=8Bsplit_part likewise takes text, not char, and so an implicit conve= rsion and trimming takes place. David j. =E2=80=8B
В списке pgsql-bugs по дате отправления: