Re: BUG #17258: Unexpected results in CHAR(1) data type

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: BUG #17258: Unexpected results in CHAR(1) data type
Дата
Msg-id CAKFQuwaiyVsPu0_z1sDQqVcFbKpLLzYuUnYca-fC+VdwN7OREg@mail.gmail.com
обсуждение исходный текст
Ответ на RE: BUG #17258: Unexpected results in CHAR(1) data type  ("David M. Calascibetta" <david@calascibetta.com>)
Список pgsql-bugs
On Fri, Oct 29, 2021 at 2:59 PM David M. Calascibetta <david@calascibetta.com> wrote:
They should behave the same, in that if I insert a blank into a char(1) column, it should store a blank value.
If I insert a blank into a varchar(1) column, it should store a blank value.  Fixed length characters would pad
on the right, but it should not distort the value I entered in any other way. In this case, I enter a blank value and
PG removes it.  That is not appropriate behavior.


As implemented it has no way to distinguish between user-added trailing whitespace and padding-added trailing whitespace.  So instead it just says "trailing whitespace is insignificant" and, further, insignificant whitespace is discarded when converting to a data type that doesn't have the concept of insignificant whitespace.

I don't necessarily agree with this either, but I'm in favor of the position that char is obsolete and should not be used in new development, nor should it be expected to be maintained.

David J.

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

Предыдущее
От: Peter Geoghegan
Дата:
Сообщение: Re: BUG #17245: Index corruption involving deduplicated entries
Следующее
От: Mark Dilger
Дата:
Сообщение: Re: BUG #17258: Unexpected results in CHAR(1) data type