SQLite

View Ticket
Login
2017-03-24
19:14 Fixed ticket [06796225]: Crash in recursive invocation of a trigger that uses an ephemeral table plus 3 other changes (artifact: 7a87396c user: drh)
18:38
Previous check-in was not correct. This is a better fix for the OP_Once problem of ticket [06796225f59c057cd120f1]. (check-in: 8194dd28 user: drh tags: trunk)
17:59
Fix the OP_Once opcode so that it works correctly for recursive triggers. Ticket [06796225f59c057cd120f1]. (check-in: 25560145 user: drh tags: trunk)
15:55 Ticket [06796225] Crash in recursive invocation of a trigger that uses an ephemeral table status still Open with 6 other changes (artifact: c5faf531 user: drh)
15:45 New ticket [06796225]. (artifact: a9dc7f75 user: dan)

Ticket Hash: 06796225f59c057cd120f1d888587873d9b0611f
Title: Crash in recursive invocation of a trigger that uses an ephemeral table
Status: Fixed Type: Code_Defect
Severity: Critical Priority: Immediate
Subsystem: Unknown Resolution: Fixed
Last Modified: 2017-03-24 19:14:17
Version Found In:
User Comments:
dan added on 2017-03-24 15:45:22:

For example:

  PRAGMA recursive_triggers = 1;

  CREATE TABLE t1(a);
  CREATE INDEX i1 ON t1(a);
  CREATE TABLE t3(c);

  CREATE TRIGGER tr AFTER INSERT ON t3 BEGIN
    INSERT INTO t3 SELECT new.c+1 WHERE new.c<5;
    SELECT * FROM t1 WHERE a IN (1, 2, 3, 4);
  END;

  INSERT INTO t3 VALUES(2);

The trigger above uses an ephemeral table for the IN(...) results. Running the sample above causes a segfault (or assert() failure if SQLITE_DEBUG is defined).


drh added on 2017-03-24 15:55:29:

The problem was introduced by check-in [6bf5ba10d28f1b0a32] on 2016-09-18 and first appeared in version 3.15.0.