Re: BUG #5028: CASE returns ELSE value always when type is"char"

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #5028: CASE returns ELSE value always when type is"char"
Дата
Msg-id 15013.1251917395@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #5028: CASE returns ELSE value always when type is"char"  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Список pgsql-bugs
"Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
> Sam Mason <sam@samason.me.uk> wrote:
>> If we did follow Kevin's request directly, should we also be
>> specifying the type of NULL?

> I don't *think* the SQL standard requires that, and barring that I
> don't see any compelling reason to type NULL.

Actually, AFAICS the SQL spec *does* require you to cast NULL literals
explicitly in nearly all contexts.  There are exceptions for assigning
NULL directly to a field (in INSERT or UPDATE), and maybe some other
places, but not many.

The PG type system treats a bare NULL literal as "unknown", so most
of the same issues come up for either NULL or literal constants.
If you were to try to get rid of the "unknown" concept, I think the
only place you'd find yourself violating the standard is the aforesaid
narrow exceptions.  Usability is a different question though ...

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #5028: CASE returns ELSE value always when type is"char"
Следующее
От: "Kevin Grittner"
Дата:
Сообщение: Re: BUG #5028: CASE returns ELSE value always when type is"char"