CREATE TABLE t2 (id1 INT NOT NULL);
CREATE TABLE t1 (id1 INT NOT NULL, t1 DATETIME NOT NULL);


delimiter //
CREATE TRIGGER t1_aitrg
 AFTER
 INSERT 
 ON t1
 FOR EACH ROW
BEGIN
INSERT INTO t2 (id1) SELECT :new.id1 WHERE NOT EXISTS (SELECT 0 FROM t2 WHERE id1=:NEW.id1);
END//
delimiter ;

CREATE OR REPLACE VIEW v_t1 AS SELECT * FROM t1 a
WHERE NOT EXISTS (SELECT 0 FROM t2 WHERE id1=a.id1)
WITH CHECK OPTION;


INSERT INTO v_t1 VALUES (1,NOW())

/* SQL Error (1442): Can't update table 't2' in stored function/trigger because it is already used by statement which invoked this stored function/trigger */

INSERT INTO t1 VALUES (1,NOW());

DROP TABLE t1;
DROP TABLE t2;