SQLite Forum

Feature Request: Support for statement-level triggers

Feature Request: Support for statement-level triggers

(1.2) By ddevienne on 2020-04-23 09:31:24 edited from 1.1 [source]

Is there a technical reason why SQLite supports only row-level triggers?
I have features of my app that depend on statement-level triggers in
other RDBMS, and the fact it's not supported in SQLite is a bummer.

The fact statement-level triggers fire only once, allow those features
to be constant time, whether the statement affects one row or one million.
One can of course use a row-level one, and somehow ignore all those other
calls, but it's both less efficient, and I'm missing the conclusion of the
statement too, similar to how an aggregate function needs to finalize at the end.

SQLite is growing very advanced features all the time, thus I'm curious
as to why statement-level triggers are kinda neglected like this. TIA.

PS: I personally thing it's a mistake to assume SQLite's only use case is embedded.
I of course embed SQLite, but also assume direct access to the DBs via the official
SQLite shell. Thus putting as much logic is the DB itself is actually quite important IMHO.