<[EMAIL PROTECTED]> wrote :

> Bertrand,
> 
> This is from the doc on  the web
> 
> 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.
> 
> So adding the Primary Key does create an index.
> 
> you can verfiy this by doing
> 
> create table a (b primary key,c);
> select * from sqlite_master;

Thank you, I wasn't sure this info was accurate as there seems to be a lot
of things that have changed since the documentation was written.

Still, if INTEGER PRIMARY KEY actually creates an UNIQUE index as stated in
the doc, then why doesn't it show in PRAGMA index_list() ?

Unless I am still missing something, I think the function would be more
helpful if it could return the exhaustive list of indexes, including the
ones created as INTEGER PRIMARY KEY.

Bertrand Mansion
Mamasam


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to