Re: DISTINCT with NULLs and INT fields

From: "George Pavlov" <gpavlov(at)mynewplace(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: DISTINCT with NULLs and INT fields
Date: 2005-12-28 20:37:29
Message-ID: CCB89282FCE1024EA3DCE687A96A5164039EC5AD@ehost010-6.exch010.intermedia.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 | 4
4 | 4
(2 rows)

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2005-12-28 20:46:29 Re: DISTINCT with NULLs and INT fields
Previous Message Tom Lane 2005-12-28 20:19:29 Re: DISTINCT with NULLs and INT fields