Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8238885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:57:47+00:00 2026-06-07T19:57:47+00:00

I try to create an instead-of trigger for an update on a table. The

  • 0

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: cannot create INSTEAD OF trigger on table. And I am wondering why.

I use foreign keys:

PRAGMA foreign_keys = ON;

And I have two tables. An identifier table:

CREATE TABLE id
(
    id      INTEGER PRIMARY KEY AUTOINCREMENT,
    created REAL    NOT NULL DEFAULT CURRENT_TIMESTAMP
);

And a table which references the identifiers:

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)
);

Insert works fine:

INSERT INTO id DEFAULT VALUES;
INSERT INTO person (login) VALUES ('root');
SELECT * FROM person;
1|root|||||2012-02-28 18:03:45

Now I want to define the following trigger, which converts an update into an insert:

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;

But it fails with the above error and I do not understand why.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T19:57:50+00:00Added an answer on June 7, 2026 at 7:57 pm

    I tried going through the source code (search for “cannot create INSTEAD OF”) and despite reading your link in the comment where the create trigger statement is outlined in great detail, I would say that triggers with INSTEAD OF are only for views and cannot be used with tables.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to create options menu in a TabActivity. But instead of it I
I've implemented the following trigger: CREATE TRIGGER [OnContactDeleted] ON [TABLE].[Contact] INSTEAD OF DELETE AS
I try create a map for open ~/.vimrc, but open the ~/.vimrc only when
I try to create styles with first-child and last-child items but I encountered a
I try to create my own linux bash script that calls truecrypt for mounting.
I am try to create a JSP page that will show all the status
hiya, i have the following code but when i try and create a new
My goal is to present a jsf page that has Create, Retrieve and Update
I try to create an EAR with the maven assembly plugin but I got
When I try to create this trigger, I get this exception: The name SITE_ID

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.