On Oct 16, 2006 7:19 PM, Norman Palardy:
> On Oct 16, 2006, at 11:46 AM, Marco Bambini wrote:
>
> > Not sure to understand what you mean, but after this statement:
> > CREATE TABLE foo (uniqueID integer PRIMARY KEY AUTOINCREMENT, ...)
> >
> > rowid is just an alias to the uniqueID column.
> > It still exists.
>
> What I mean is that a person should ALWAYS define a primary
> key and not simply rely on the row id hoping that it will be
> unique.

Agree!

> Some databases do guarantee that the row id will be a unique,
> strictly increasing sequence that you could use reliably.
> Some don't.
> SQLite, by default, does not.

Correct, even if you specify a primary key without the AUTOINCREMENT
keyword!

But if you use the AUTOINCREMENT keyword with a primary key, SQLite
guarantees the rowid to be unique, even if you delete records it will
not use any rowid previously used by a record - it keeps track of the
largest rowid used by using the special SQLITE_SEQUENCE table. More
info at:
http://www.sqlite.org/autoinc.html

Carlos

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to