Re: [pgsql-advocacy] Oracle buys Innobase

Поиск
Список
Период
Сортировка
От Doug Quale
Тема Re: [pgsql-advocacy] Oracle buys Innobase
Дата
Msg-id 878xwokk4d.fsf@charter.net
обсуждение исходный текст
Ответ на Re: [pgsql-advocacy] Oracle buys Innobase  ("Guy Rouillier" <guyr@masergy.com>)
Ответы Re: [pgsql-advocacy] Oracle buys Innobase  ("Marc G. Fournier" <scrappy@postgresql.org>)
Список pgsql-general
"Guy Rouillier" <guyr@masergy.com> writes:

> Doug Quale wrote:
>>
>> # select 'a'::char(8) = 'a '::char(8);
>>  ?column?
>> ----------
>>  t
>> (1 row)
>>
>> Trailing blanks aren't significant in fixed-length strings, so the
>> question is whether Postgresql treats comparison of varchars right.
>
> This result is being misinterpreted.
>
> select length('a'::char(8)) ==> 1
> select length('a '::char(8)) ==> 1
>
> So it isn't that the two different strings are comparing equal.  The
> process of casting them to char(8) is trimming the blanks, so by the
> time they become fixed length strings, they are indeed equal.

Huh??? What version of PG are you using?  On 7.4.9,


test=# select length('a'::char(8));
 length
--------
      8
(1 row)

test=# select length('a '::char(8));
 length
--------
      8
(1 row)

The truncation you describe would simply be wrong.

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] 'a' == 'a '
Следующее
От: Andrew Sullivan
Дата:
Сообщение: Re: Select all invalid e-mail addresses