Re: DISTINCT with NULLs and INT fields - Mailing list pgsql-sql

From George Pavlov
Subject Re: DISTINCT with NULLs and INT fields
Date
Msg-id CCB89282FCE1024EA3DCE687A96A5164039EC5AD@ehost010-6.exch010.intermedia.net
Whole thread Raw
In response to DISTINCT with NULLs and INT fields  ("George Pavlov" <gpavlov@mynewplace.com>)
Responses Re: DISTINCT with NULLs and INT fields  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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 by date:

Previous
From: Tom Lane
Date:
Subject: Re: DISTINCT with NULLs and INT fields
Next
From: Tom Lane
Date:
Subject: Re: DISTINCT with NULLs and INT fields