Replies: 1 comment
-
It was a design choice to keep the library simple. pgtrigger maintains a hash to know if the trigger has changed. If I understand what you want to do, you'll have to maintain two hashes. This could make the integration with Django's migration system much more complex among other things. For example, pgtrigger maintains the hash as a comment on the trigger itself. This is used to cross-reference trigger definitions in code to ensure they match what's installed in the DB, and it helps support users that want to install triggers manually without migrations. You're welcome to try to solve it, but I can't guarantee that I would accept it if it introduces a lot of complexity. Making pgtrigger work with Django's migration system was extremely involved. I'd be worried about it not working correctly and then users not having correct triggers installed. One solution I could imagine is making a subclass of the migration operation that only drops/re-creates the function, and then leaving it up to users to edit the default migrations if they wish to optimize them in this manner |
Beta Was this translation helpful? Give feedback.
-
Assume you have a model with:
And then you modify just the function in your model
ORIGINAL_FUNCTION
->NEW_FUNCTION
The current strategy of pgtrigger is to:
The issue is for such operations
CREATE TRIGGER
requires aSHARE ROW EXCLUSIVE
lock (postgres documentation)and i believe
DROP TIGGER
requires anACCESS EXCLUSIVE
lock (postgres issue)For such cases I think it would be beneficiary if we could just do:
Can you tell me if this a design choice and if not I could probably go and try to implement this approach.
Beta Was this translation helpful? Give feedback.
All reactions