On Fri, Jun 7, 2013 at 11:51 AM, Ryan Johnson
<ryan.john...@cs.utoronto.ca>wrote:

> On 06/06/2013 10:52 AM, Gabriel Corneanu wrote:
>
>> In my opinion, count(*) is the same as count(rowid) (I see that even
>> count() is accepted); I could say it's even the same as count(x) (any
>> other
>> field).
>>
> Not quite... count(x) only counts rows having non-NULL x. Granted, that's
> not a problem for rowid/pk (which are not allowed to be NULL), but it
> matters a lot in the general case.
>

PRIMARY KEYs (except for INTEGER PRIMARY KEYs) are allowed to be NULL in
SQLite.  This goes back to a bug in the code from many years ago.  By the
time the bug was discovered, SQLite was already in wide-spread use and so
the decision was made to not fix the bug since doing so would cause
compatibility problems.

-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to