Y
Hacker News
new
|
ask
|
show
|
jobs
by
candiddevmike
336 days ago
How do you handle trigger logic that compares old/new without having a round trip back to the application?
1 comments
SoftTalker
336 days ago
Do it in a stored procedure not a trigger. Triggers have their place but a stored procedure is almost always better. Triggers can surprise you.
link
candiddevmike
336 days ago
I don't follow how you would do that in a stored procedure outside of a trigger.
link
const_cast
336 days ago
I think instead of performing an INSERT you call a stored proc that does the insert and some extra stuff.
link
shivasaxena
336 days ago
Yes, we already have all of our business logic in postgres functions(create_order, create_partial_payment etc).
Doing the extra work in stored procedures is noticeably faster than relying on triggers.
link