On Nov 20, 2008, at 4:39 PM, Hugh Gibson wrote:

>>> According to Igor all that happens when you create a primary
>>> key is that an index with the unique constraint is created. And
>>> the only good reason for not being able to drop it, as far as I
>>> can tell, is so that the SQL statement stored for the table is not
>>> made invalid.
>>
>> Yes, however, if you do define a PRIMARY KEY then that internal
>> index is used instead of the ROWID, hence, you can't delete that
>> because it would violate what you told the db to do otherwise.
>
> Ah, OK. So there is an internal implication of PRIMARY KEY vs a UNIQUE
> index. Thanks.

No. There is no difference in the implementation of a PRIMARY KEY
and a UNIQUE index (unless the PRIMARY KEY happens to be an
INTEGER PRIMARY KEY, in which case it is an alias for the table's
rowid). The first part of the statement you are responding to is a
bit misleading.

You were correct when you said that an automatically created index
cannot be dropped because dropping it would prevent SQLite from
correctly implementing the PRIMARY KEY or UNIQUE clauses of the
CREATE TABLE declaration.

Dan.

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

Reply via email to