SQLite Forum

Recursive TRIGGER stopping on reference to same table
Login
Did you turn on recursive triggers either by compiling your SQLite3 library with `SQLITE_DEFAULT_RECURSIVE_TRIGGERS` defined as 1 or using `pragma recursive_triggers=1` on the connection?

<https://sqlite.org/pragma.html#pragma_recursive_triggers>

```
sqlite> CREATE TABLE a
   ...> (
   ...>     id         INTEGER,
   ...>     fromA      INTEGER,
   ...>     sharedProp TEXT
   ...> );
sqlite>
sqlite> CREATE TABLE b
   ...> (
   ...>     id         INTEGER,
   ...>     fromA      INTEGER,
   ...>     sharedProp TEXT
   ...> );
sqlite>
sqlite> CREATE TRIGGER a_sharedProp_updated AFTER UPDATE ON a
   ...> BEGIN
   ...>     UPDATE a SET sharedProp = NEW.sharedProp WHERE fromA = NEW.id;
   ...>     UPDATE b SET sharedProp = NEW.sharedProp WHERE fromA = NEW.id;
   ...> END;
sqlite>
sqlite> INSERT INTO a VALUES (1, NULL, 'foo'), (2, 1, 'foo');
sqlite> INSERT INTO b VALUES (1, 2, 'foo');
sqlite> UPDATE a SET sharedProp = 'bar' WHERE id = 1;
sqlite> SELECT sharedProp FROM b;
bar
```

As an aside, can you please use proper quotes?

Text strings are delimited with single-quote ('), not double-quote (").  Double-quote is used to delimit identifiers (column names, table names, index names, trigger names, and so on and so forth).