Re: [SQL] Comparison semantics of CHAR data type

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: [SQL] Comparison semantics of CHAR data type
Дата
Msg-id 20140214024701.GA3243@momjian.us
обсуждение исходный текст
Ответ на Re: [SQL] Comparison semantics of CHAR data type  (Bruce Momjian <bruce@momjian.us>)
Ответы Re: [SQL] Comparison semantics of CHAR data type  (Bruce Momjian <bruce@momjian.us>)
Список pgsql-hackers
On Wed, Oct 16, 2013 at 02:17:11PM -0400, Bruce Momjian wrote:
> > > You can see the UTF8 case is fine because \n is considered greater
> > > than space, but in the C locale, where \n is less than space, the
> > > false return value shows the problem with
> > > internal_bpchar_pattern_compare() trimming the string and first
> > > comparing on lengths.  This is exactly the problem you outline, where
> > > space trimming assumes everything is less than a space.
> >
> > For collations other than C some of those issues that have to do with
> > string comparisons might simply be hidden, depending on how strcoll()
> > handles inputs off different lengths: If strcoll() applies implicit
> > space padding to the shorter value, there won't be any visible
> > difference in ordering between bpchar and varchar values.  If strcoll()
> > does not apply such space padding, the right-trimming of bpchar values
> > causes very similar issues even in a en_US collation.

I have added the attached C comment to explain the problem, and added a
TODO item to fix it if we ever break binary upgrading.

Does anyone think this warrants a doc mention?

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + Everyone has their own god. +

Вложения

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

Предыдущее
От: Jerry Sievers
Дата:
Сообщение: HBA files w/include support?
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: HBA files w/include support?