Hmm. Have you actually tried this yourself?

Here's what I get with a simplified example:

CREATE VIRTUAL TABLE keyword using FTS3(programId INTEGER PRIMARY KEY,
title);
INSERT OR IGNORE INTO keyword (programId, title) VALUES(3, "A");
INSERT OR IGNORE INTO keyword (programId, title) VALUES(3, "A");
sqlite> select * from keyword;
3|A
3|A

So clearly this doesn't work as now duplicates are allowed to be inserted.
If I execute this command now:

INSERT OR IGNORE INTO keyword (ROWID, title) VALUES(3, "A");
SQL error: constraint failed

So, clearly there is no duplicate checking at all when the explicit key name
is used but then it's useless as I can't have duplicate keys.


Simon Slavin-3 wrote:
> 
> 
> On 4 Nov 2009, at 5:12am, sorka wrote:
> 
>> Is there any way to have an intsert into an FTS3 table ignore a row  
>> if the
>> ROWID being inserted already exists?
> 
> First, make whatever column you're using for ROWID explicit, not  
> implicit.  Declare one of your own named columns as INTEGER PRIMARY  
> KEY.  Then when you use the INSERT command you can use the
> 
> INSERT OR IGNORE ...
> 
> form of the command and it'll ignore the command if it would duplicate  
> the value in that column.
> 
> Simon.
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

-- 
View this message in context: 
http://old.nabble.com/FTS3-IGNORE-OR-REPLACE-----tp26191125p26200309.html
Sent from the SQLite mailing list archive at Nabble.com.

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

Reply via email to