Does Odata return response before DB Triggers are fired?

Hello team,


I have written a script using SEQUENCE & TRIGGERS for PostGres to auto increment the record number. This was a decision taken to avoid writing multiple codes through JS and Server side because we get inputs from a lot of sources - 3rd party integration, manual entry & business process.


While our trigger works well, we noticed that using odata, the response returned does not have the auto numbered value, whereas the auto numbering is indeed getting stored in the data base.


The question is, does Odata response for POST requests get triggered after all DB triggers are completed or does it happen just before a record is inserted into the DB?

PS: I tried triggers using BEFORE update and it did not work

Like 0




This question needs to be analyzed mo deeply, but, based on your information, the POST request isn't affected by all the DB triggers and therefore happens before the insert.

Also, a small note, if you have autonumbering both on the JS and Server side than a new number will be generated no matter what is the source of the object (data, business process, etc).

Show all comments