On 3 Apr 2017, at 12:41am, David Burgess <dburg...@gmail.com> wrote:

> Bad trigger performance prevents me using your suggested solution.

I’d like to see your TRIGGER.  But if a well-written TRIGGER can’t reach the 
performance you need (it’ll never be as fast as a constraint) then your best 
solution is to do sanity-checking in your programming language.

> Is there a secret to making triggers perform like CHECK?

No.  They do two different jobs.  CHECK is to ensure integrity of the TABLE.  A 
constraint applies to all the rows in the table all the time.  The thing you 
want does not involve CHECK since existing entries in the database which 
violate your rule are not a problem.

TRIGGERs apply when things are added to, modified, or deleted from the TABLE.  
But a TRIGGER can be used to check /new/ entries in the database.  It would 
seem that a TRIGGER might be useful to you.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to