On Mon, 6 Dec 2010 18:51:25 +0000 (UTC), Oliver Peters
<oliver....@web.de> wrote:

>Hello,
>
>I've tried to create this trigger:
>
>----------------------------------------------------------
>CREATE TRIGGER log_DELETE_staff
>                       AFTER DELETE ON staff FOR EACH ROW
>                       BEGIN
>                               INSERT INTO
>xlog_staff(idOLD,id_staff_editorNEW,id_staff_editorOLD,codeOLD,forenameOLD,
>nameOLD,sqlaction)VALUES(old.id,(SELECT id FROM
>temp.user_signed_in),old.id_staff_editor,old.code,old.forename,old.name,'D');
>                       END;
>
>----------------------------------------------------------
>
>but get
>
>SQLite Error 1 - trigger log_DELETE_staff cannot refrence objects in
>database temp
>
>as an error message - but I can only find that "the table to be modified must
>exist in the same database as the table or view to which the trigger is
>attached". In this case this is completely true because only part of the source
>"(SELECT id FROM temp.user_signed_in)" is in another database.

The wording is not completely correct indeed.
In general, views, triggers, and foreign key constraints can only
use objects within the same schema (=database).

That makes sense, because SQLite (and you) cannot guarantee the
other database file is attached when the view is used, the trigger
fires, or the reference is referred.

>Oliver

-- 
  (  Kees Nuyt
  )
c[_]
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to