SQLite Forum

.selecttrace unknown and strange errors
Your A1_100 trigger is ill_conceived.  

It seems to assume that the value of A1_STATUS is being changed however there is no condition which requires this to be the case.  

You are merely reacting to the value of NEW.A1_STATUS being 2.  A change is being made to the status ONLY in the case where `OLD.A1_STATUS IS NOT NEW.A1_STATUS`.

Any update to A1 where the value of A1_STATUS happens to be 2 and not updated will also fire the trigger, but will "treat" the update as changing the value of A1_STATUS even though it is not, in fact, being changed.

This is particularly evident in the part of the code that:

                                WHEN ((SELECT C1_STATUS FROM C1 WHERE C1_INDEX == NEW.A1_INDEX) != 4)
                                        THEN RAISE (ABORT, 'Error you are not allowed to change the status')

which spits an error about changing the status being prohibited when in fact attempting to change the status is not a pre-condition to throwing that error.  If the message said "cannot have status == 2" then it would be correct, but it is claiming conditions extant which do not in fact exist.