title: Why Sqlite Error: cannot create INSTEAD OF trigger on table?
body: <p>I try to create an instead-of trigger for an update on a table. The normal use of instead-of triggers are views but the Sqlite manual says that instead-of triggers are also valid for tables. But I get the error: <em>cannot create INSTEAD OF trigger on table</em>. And I am wondering why.</p>
  
  <p>I use foreign keys:</p>
  
  <pre><code>PRAGMA foreign_keys = ON;
  </code></pre>
  
  <p>And I have two tables. An identifier table:</p>
  
  <pre><code>CREATE TABLE id
  (
      id      INTEGER PRIMARY KEY AUTOINCREMENT,
      created REAL    NOT NULL DEFAULT CURRENT_TIMESTAMP
  );
  </code></pre>
  
  <p>And a table which references the identifiers:</p>
  
  <pre><code>CREATE TABLE person
  (
      id        INTEGER NOT NULL DEFAULT (last_insert_rowid()) REFERENCES id,
      login     TEXT,
      password  TEXT,
      firstname TEXT,
      lastname  TEXT,
      email     TEXT,
      created   REAL  NOT NULL DEFAULT CURRENT_TIMESTAMP,
      PRIMARY KEY (id, created)
  );
  </code></pre>
  
  <p>Insert works fine:</p>
  
  <pre><code>INSERT INTO id DEFAULT VALUES;
  INSERT INTO person (login) VALUES ('root');
  SELECT * FROM person;
  1|root|||||2012-02-28 18:03:45
  </code></pre>
  
  <p>Now I want to define the following trigger, which converts an update into an insert:</p>
  
  <pre><code>CREATE TRIGGER person_update INSTEAD OF UPDATE OF login, password, firstname, lastname, email ON person
  BEGIN
      INSERT INTO person (login, password, firstname, lastname, email)
      VALUES (new.login, new.password, new.firstname, new.lastname, new.email);
  END;
  </code></pre>
  
  <p>But it fails with the above error and I do not understand why.</p>