On 30 Sep 2016, at 2:33pm, Malte Legenhausen <mlegenhau...@gmail.com> wrote:

> sqlite> create table t1(one varchar(10));
> sqlite> CREATE INDEX unique_one ON t1 (one);
> sqlite> create table t2(one varchar(10));
> sqlite> CREATE INDEX unique_one ON t2 (one);
> Error: index unique_one already exists
> 
> This is an unintended behaviour cause the following command returns with an 
> empty result:
> 
> sqlite> PRAGMA INDEX_LIST(t2);

Index names have to be unique to the entire database, not just the table 
they're indexing.  You are explicitly looking just for indexes to the t2 table.

If you want to check whether an index name is in use use

PRAGMA index_info(index-name)

If you get a blank response then no such index exists.

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

Reply via email to