Shawn Wilsher <[EMAIL PROTECTED]> wrote:
> On Tue, Jul 1, 2008 at 3:37 PM, Igor Tandetnik
> <[EMAIL PROTECTED]> wrote:
>> They won't fail - they will successfully insert zero records. It's
>> perfectly valid to run INSERT ... SELECT and have the SELECT part
>> produce an empty resultset. It simply does nothing.
>
> Sorry, I should have been more explicit in what we are doing.  The
> select will return results

Will it? <the data is currently not in temp table> part is supposed to 
be false when the data is in fact currently in temp table. A WHERE 
clause that is always false will, naturally, produce no records.

>  because we do not want to delete the data
> from the temporary table (that involves a write and fsyncing).
> However, I think I've come up with a solution:
> CREATE TRIGGER ....
> BEGIN
>  INSERT OR REPLACE INTO temp_table

REPLACE clause works by deleting a conflicting record then inserting a 
new one. Since you say you don't want to delete records from temp_table, 
I don't quite see what you are gaining.

> This works since the UNION will select entries from the temp table
> first, and ignore those in the permanent table that have the same
> primary key (that is, assuming I understand UNION properly).

UNION has nothing to do with primary key. It only eliminates duplicate 
records - records with all fields equal.

Igor Tandetnik 



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

Reply via email to