Re: ODP: ODP: [firebird-support] trigger not firing?
Nope... :( So, do you think that no database corruption can make this to happen? I have two options here: the former... or I have a very hidden bug which I didn't found yet which is deleting those missing records... just in case, I created an "after delete" trigger to log any possible deletion... will see... Sergio
ODP: ODP: [firebird-support] trigger not firing?
>>The table "sto_depositos" (it means warehouses) is populated entering all the >>warehouses manually. >>It barely changes. Then when it is changing you can have situation like this? Transaction 1 start Transaction 2 start Tranaction 1 change sto_depositos Transaction 2 manipulate data and fire that trigger, which do not see modification from Transaction 1 as it is not commited yet. Transaction 2 commit; Transaction 1 commit; As you can see, you can loose records… I do not know if this is in your case.. Regards, Karol Bieniaszewski
Re: ODP: [firebird-support] trigger not firing?
Thanks Karol!! The table "sto_depositos" (it means warehouses) is populated entering all the warehouses manually. It barely changes. The "activo" field is used to hide some warehouse I'm not longer using... Sergio
Re: ODP: [firebird-support] trigger not firing?
Thanks for the answer! > It depend how you table sto_depositos is populated and when you set activo=1? The table is populated by this trigger, and the "activo" field doesn't change (almost) ever!!! I'ts use only if I want to hide a warehouse that is not used anymore... Sergio.
Re: [firebird-support] trigger not firing?
Thanks!!! > Have you checked if the trigger is still active, maybe it was disabled? Yes I've checked it. The trigger is enabled and nobody disabled it before. I'm the only one who changes such things... > In the face of bugs or a corrupted database, of course anything is possible, > but that should - > in most cases - still produce errors. Well... of course, now that I'm testing > it, the trigger fires as expected. The database is quite big, but as far as I > can tell (I've searched trough the metadata) nothing is deleting records from > the table "sto_cantidades"... that's why I asked if someone had a similar > experience, on triggers "not being fired" Of course, I'm still looking into > my code... I don't discard the chance that in some hidden and oscure place > I'm deleting by mistake those records!!! :) > Not related to your problem, > but using insert ... > select is probably more efficient (and simpler to read in my opinion) Yes! > could be done that way. Thanks for the advice!!! Sergio
ODP: [firebird-support] trigger not firing?
It depend how you table sto_depositos is populated and when you set activo=1? Pozdrawiam, Karol Bieniaszewski Od: shg_siste...@yahoo.com.ar [firebird-support] Wysłano: wtorek, 25 września 2018 16:49 Temat: [firebird-support] trigger not firing? Hello! I use FB 2.5. I know that this its almos imposible, but just in case I ask. Is there any chance that a trigger is not firing at all? I have this very simple trigger to create one record for each warehouse in the "stock" table. But I've found that quite a lot of articles (in the stock table) doesn't have its records in the "sto_cantidades" table. It is possible that some kind of corruption causes that? or should I chek my entire code and see if that records are somehow being deleted? thanks!! CREATE OR ALTER trigger stock_ai5 for stock active after insert position 5 AS declare variable loc_id fk_id; begin for select id from sto_depositos where activo = 1 into :loc_id do begin insert into sto_cantidades (id_stock, id_sto_depositos, cantidad) values (new.id, :loc_id, 0); end end [Non-text portions of this message have been removed]
Re: [firebird-support] trigger not firing?
On 25-9-2018 16:49, shg_siste...@yahoo.com.ar [firebird-support] wrote: > Hello! I use FB 2.5. I know that this its almos imposible, but just in > case I ask. Is there any chance that a trigger is not firing at all? Have you checked if the trigger is still active, maybe it was disabled? > I have this very simple trigger to create one record for each warehouse > in the "stock" table. But I've found that quite a lot of articles (in > the stock table) doesn't have its records in the "sto_cantidades" table. > > It is possible that some kind of corruption causes that? or should I > chek my entire code and see if that records are somehow being deleted? In the face of bugs or a corrupted database, of course anything is possible, but that should - in most cases - still produce errors. > CREATE OR ALTER trigger stock_ai5 for stock > active after insert position 5 > AS > declare variable loc_id fk_id; > begin > for select id from sto_depositos where activo = 1 into :loc_id do > begin > insert into sto_cantidades (id_stock, id_sto_depositos, cantidad) > values (new.id, :loc_id, 0); > end > end Not related to your problem, but using insert ... select is probably more efficient (and simpler to read in my opinion) -- Mark Rotteveel