BUG #5438: Bug/quirk in ascii() function

Поиск
Список
Период
Сортировка
От Christoph Zwerschke
Тема BUG #5438: Bug/quirk in ascii() function
Дата
Msg-id 201004260814.o3Q8E0Ne089867@wwwmaster.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #5438: Bug/quirk in ascii() function  (Takahiro Itagaki <itagaki.takahiro@oss.ntt.co.jp>)
Список pgsql-bugs
The following bug has been logged online:

Bug reference:      5438
Logged by:          Christoph Zwerschke
Email address:      cito@online.de
PostgreSQL version: 8.0-8.4
Operating system:   all
Description:        Bug/quirk in ascii() function
Details:

As you would expect,

   ascii(cast(' ' as char(1)))

yields 32 in Oracle, SQL Server and MySQL.

However, in PostgreSQL 8.0 to 8.4,

   ascii(cast(' ' as char(1))),
   ascii(cast(' ' as char))

both give 0. I can imagine why this happens (after all, ' ' is the same as
'' when casted to char), but it is not obvious and what you expect, and
different from the behavior of the other database engines.

With variable length strings, it works as expected,

   ascii(' '),
   ascii(cast(' ' as varchar(1))),
   ascii(cast(' ' as varchar))

all give 32.

I think this quirk should be fixed or at least mentioned in the
documentation of ascii().

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: PostgreSQL 8.4.3: configure script on Debian Lenny with libbsd-dev and libbsd0 installed does not detect strlcpy and strlcat functions
Следующее
От: Takahiro Itagaki
Дата:
Сообщение: Re: BUG #5438: Bug/quirk in ascii() function