Re: DISTINCT with NULLs and INT fields

Поиск
Список
Период
Сортировка
От George Pavlov
Тема Re: DISTINCT with NULLs and INT fields
Дата
Msg-id CCB89282FCE1024EA3DCE687A96A5164039EC5AD@ehost010-6.exch010.intermedia.net
обсуждение исходный текст
Ответ на DISTINCT with NULLs and INT fields  ("George Pavlov" <gpavlov@mynewplace.com>)
Ответы Re: DISTINCT with NULLs and INT fields  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql
> "Better" is in the eye of the beholder.

sorry for the value-laden term. "laxer" is more appropriate, of course!
the funny thing is that had they cast the NULLs to TEXT it would have
failed there too (they do not do implicit TEXT to INT).

> It surprises me not  at all that
> Microsoft would be lax about implicit coercions, but that doesn't make
> it a good idea to coerce anything to anything else without complaint.
> You might as well not have a type system at all, if you're going to
> destroy its ability to detect mistakes that way.

indeed! but, wait, doesn't our favorite dbms do some implicit casting
too? continuing with my table foo (a varchar, b int):

test=# delete from foo;
DELETE 2
test=# insert into foo values (4,4);
INSERT 0 1
test=# insert into foo values ('4','4');
INSERT 0 1
test=# insert into foo values ('oh','no');
ERROR:  invalid input syntax for integer: "no"
test=# select * from foo;a | b
---+---4 | 44 | 4
(2 rows)


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: DISTINCT with NULLs and INT fields
Следующее
От: Tom Lane
Дата:
Сообщение: Re: DISTINCT with NULLs and INT fields