SQLite

View Ticket
Login
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.