Re: comparing rows

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: comparing rows
Дата
Msg-id 7622.965312595@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: comparing rows  (Don Baccus <dhogaza@pacifier.com>)
Ответы Re: comparing rows  (Don Baccus <dhogaza@pacifier.com>)
Список pgsql-hackers
Don Baccus <dhogaza@pacifier.com> writes:
> If foo = NULL is illegal, doesn't this make it rather difficult to
> say things like table1.i = table2.i for tables that contain NULLs
> in column i?

Thomas is not saying that the *operation* is illegal.  His point is
purely a syntactic one: SQL92 allows the keyword "NULL" only in certain
specified contexts, and out on its own as a component of an arithmetic
expression ain't one of them.  You could legally write the same thing in
at least two ways, though:
foo = (CASE WHEN TRUE THEN NULL END)
foo = (CAST NULL AS somedatatype)

It may be that the SQL92 authors intended this restriction to avoid
having to figure out what datatype an unadorned NULL is.  Unfortunately
they blew it in the CASE case :-(, so you still have to have a way of
deciding that.

As far as I can see, allowing NULL as a general-purpose literal is a
perfectly reasonable spec extension that *everybody* does, including us.
Thomas may be the only person anywhere who is bothered by it ;-)
        regards, tom lane


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

Предыдущее
От: Magnus Hagander
Дата:
Сообщение: RE: comparing rows
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: comparing rows