SQLite Forum

create trigger
Login
Sure it does have knowledge of the row which caused the trigger to execute.

The magic table name "new" refers to new values in the row and the magic table name "old" refers to the old values in the row, that caused the trigger to fire.

For an INSERT there are only "new" values, since the row did not exist prior to being inserted, hence there are no "old" values.

For DELETE triggers there are only "old" values because after the row is deleted it no longer exists and has no "new" values.

For UPDATE triggers there are both "old" (before the update) and "new" (after the update) values.

If you try to refer to "old" or "new" where they do not exist you should get an error when you attempt to prepare the statement which would fire that trigger since it references a table that does not exist.

Unless, of course, you have a table called "old" or "new" (or "excluded") in which case I have no idea what would happen.  You could try and see, or just not name things such that they conflict with the names of builtin things.  My reasonable expectation is that the "new", "old", and "excluded" table names would obscure tables by the same name.