Skip to content

OOL - Optimistic object locking implementation #182

Answered by wesleykendall
pySilver asked this question in Q&A
Discussion options

You must be logged in to vote

For 3) and 4), one pattern is the official interface pattern in pgtrigger. In other words, force every update in your app to go through the same interface(s) so that the version field is always provided.

Briefly, the official interface pattern is to block all updates on the table with protection triggers and decorator your official interfaces with @pgtrigger.ignore("protection_trigger_name").

Hope that helps. I'm happy to accept more examples in the docs for patterns like these. There's many useful patterns like these you can apply with both triggers and pgtrigger's ability to ignore execution of triggers from the application

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@wesleykendall
Comment options

Answer selected by wesleykendall
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
2 participants