Re: Trigger name missing

Dan Kennedy <[email protected]> Wed, 26 Feb 2020 21:15:47 +0700
Newsgroups gmane.comp.db.sqlite.general
Message-ID <[email protected]>
On 26/2/63 16:31, Jean-Luc Hainaut wrote:
> Hi all,
>
> It seems that SQLite (version 31.1) accepts a trigger declaration in 
> which the name is missing. When fired, this trigger doesn't crashes 
> but exhibits a strange behaviour. In particular, while expression 
> "new.<colName>" in an "insert" trigger returns the correct value, the 
> equivalent expression "select <colName> from T where Id = new.Id" 
> always returns null (column "Id" is the PK of table "T"). Similarly, 
> "update T set <columnName> = <expression>  where Id = new.Id" 
> (silently) fails.


A statement like the following creates a "BEFORE" trigger named "AFTER". 
Does that explain things?

   CREATE TRIGGER AFTER INSERT ON t1 BEGIN
     ...
   END;

I find I fall into this trap about once every 18 months...

Dan.



>
> Not critical but annoying if you are, like me, absent minded when 
> typing code!
>
> Regards
>
> Jean-Luc Hainaut
>
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users