-----Original Message-----
From: Greg Obleshchuk [mailto:[EMAIL PROTECTED]
Sent: Monday, February 09, 2004 4:00 PM
To: Williams, Ken; [EMAIL PROTECTED]
Subject: Re: [sqlite] Re: [inbox] Re: [sqlite] Primary key and index


Hi Ken,
 
>Every sqlite table has an (hidden) index for its OID.  When you create a
>column as INTEGER PRIMARY KEY, the index for that column will simply be the
>OID index.  So creating another one is unnecessary.

Not that I disagree with you but where are you getting this information
from? I just want to do some reading on it. 
 
 

It's this paragraph from the documentation that's been cited already in this
thread:
 
----------------------
Specifying a PRIMARY KEY normally just creates a UNIQUE index on the primary
key. However, if primary key is on a single column that has datatype
INTEGER, then that column is used internally as the actual key of the B-Tree
for the table. This means that the column may only hold unique integer
values. (Except for this one case, SQLite ignores the datatype specification
of columns and allows any kind of data to be put in a column regardless of
its declared datatype.) If a table does not have an INTEGER PRIMARY KEY
column, then the B-Tree key will be a automatically generated integer. The
B-Tree key for a row can always be accessed using one of the special names
"ROWID", "OID", or "_ROWID_". This is true regardless of whether or not
there is an INTEGER PRIMARY KEY.
----------------------
 
 -Ken

Reply via email to