Ticket Hash: | 17db54d7440281f2c24848f4571f83ab9fca1197 | |||
Title: | Unexpected error in DELETE with existing trigger | |||
Status: | Closed | Type: | Code_Defect | |
Severity: | Critical | Priority: | Immediate | |
Subsystem: | Unknown | Resolution: | Not_A_Bug | |
Last Modified: | 2019-08-14 19:55:58 | |||
Version Found In: | 3.29.0 | |||
User Comments: | ||||
mrigger added on 2019-08-14 19:47:19:
Consider the following example: CREATE TABLE t0(c0); CREATE TRIGGER tr0 AFTER DELETE ON t0 WHEN c0 BEGIN DELETE FROM t0; END; DELETE FROM t0; -- unexpected: no such column: c0 The error that no column c0 exists is surprising, since it has not been deleted. dan added on 2019-08-14 19:55:58:
This seems to be working as designed. The "no such column" error refers to the "c0" in the trigger. In this context "old.c0" would work, but there is no column that can be referred to as just "c0". The error occurs when the DELETE is prepared, not when the trigger is created, as SQLite does not resolve column or table references when triggers and views are created, only when they are used. This can be surprising. |