Re: BUG #13934: wrong result of split_part with char value

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: BUG #13934: wrong result of split_part with char value
Дата
Msg-id 56BA05C4.7010004@joeconway.com
обсуждение исходный текст
Ответ на Re: BUG #13934: wrong result of split_part with char value  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: BUG #13934: wrong result of split_part with char value
Список pgsql-bugs
On 02/08/2016 06:00 PM, David G. Johnston wrote:
> On Monday, February 8, 2016, <dominik.kosiorek@infobright.com
> This calls for another round of "don't use char=E2=80=9D advice...
>=20
> It is not a bug but a result of the fact that trailing white space in
> char values is able to be trimmed away thus leaving you the empty strin=
g
> and no splitting.

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)

And if you feed an actual space to split_part(), it works as expected.

test=3D# select split_part(a2,' ',a4field) from string1postgres;
 split_part
------------
 abcd
(1 row)

HTH,

Joe

--=20
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: BUG #13936: jsonb_object() -> ERROR: unknown type of jsonb container
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #13937: 'src' -> jsonb_each() -> jsonb_object() -> 'dst' does not recreate 'src' as valid jsonb