Re: [sqlite] Unique index versus unique constraint

2011-03-19 Thread Simon Slavin
On 19 Mar 2011, at 7:52am, Paul van Helden wrote: > It actually makes sense to never drop any automatic index (!). My question > should have been how to reliably determine whether an index is automatic or > not. Unless someone can come up with a compelling reason not to test for >

Re: [sqlite] Unique index versus unique constraint

2011-03-19 Thread Paul van Helden
> > Automatic indexes have no "SQL" entry in the SQLite_Master table, so you > can use that to see if you can drop it. eg: > > select Name from SQLite_Master where type = 'index' and SQL is null > > will give you the name of all the automatic indexes, which can't be > dropped. > Thanks Tom, It

Re: [sqlite] Unique index versus unique constraint

2011-03-18 Thread BareFeetWare
On 18/03/2011, at 8:58 PM, Paul van Helden wrote: > Another solution that ocurred to me is to check for "sqlite_autoindex_" in > the name field of pragma index_list(tablename). Can I simply assume that > unique indexes named sqlite_autoindex_* cannot be dropped? Automatic indexes have no "SQL"

Re: [sqlite] Unique index versus unique constraint

2011-03-18 Thread Simon Slavin
On 18 Mar 2011, at 9:58am, Paul van Helden wrote: > So my problem is, I need to know how the unique requirement was created in > the first place in order to get rid of it in the appropriate manner. > > One solution would be to parse the SQL field in sqlite_master to look for > the constraint.

[sqlite] Unique index versus unique constraint

2011-03-18 Thread Paul van Helden
Hi All, When I create a table and specify a unique constraint, a unique index is automatically created. This index cannot be dropped, so the only way to get rid of the uniqueness is to recreate the table without the constraint. No problem. When I create a table without the unique constraint, I