BUG #12462: NULLIF changes the argument type

Поиск
Список
Период
Сортировка
От tneumann@users.sourceforge.net
Тема BUG #12462: NULLIF changes the argument type
Дата
Msg-id 20150108161155.11500.32736@wrigleys.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #12462: NULLIF changes the argument type  (Kevin Grittner <kgrittn@ymail.com>)
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      12462
Logged by:          Thomas Neumann
Email address:      tneumann@users.sourceforge.net
PostgreSQL version: 9.4.0
Operating system:   Linux 3.16.0
Description:

The SQL standard in Section 6.11, Syntax rule 1 c) says that

""
NULLIF (V1, V2) is equivalent to the following <case specification>:
CASE WHEN
V1=V2 THEN
NULL ELSE V1
END
""

which is currently not the case in Postgres. Postgres promotes V1 to the
type of V2, which can lead to behavior changes.

Example query as illustration: It should produce 0,0,0 (and does on SQL
Server and DB2), but PostgreSQL promotes the type and produces 0,0.5,0

select 1/2,nullif(1,2.3)/2,case when 1=2.3 then NULL else 1 end/2

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

Предыдущее
От: Thomas Neumann
Дата:
Сообщение: Re: BUG #12458: Comparison with CHAR is inconsistent between string types
Следующее
От: Kevin Grittner
Дата:
Сообщение: Re: BUG #12462: NULLIF changes the argument type