What are the possible ways to prevent race conditions in this postgres insert operation?
Here are typescript types for
I want it so that any time a section can only contain many instructions or many sections but not both. How do I enforce this while preventing race conditions that could create inconsistencies? For example take a look at the following code:
There is a race condition here during the time between
instructions and sections database tables:I want it so that any time a section can only contain many instructions or many sections but not both. How do I enforce this while preventing race conditions that could create inconsistencies? For example take a look at the following code:
There is a race condition here during the time between
START and END where the parent section could be made to contain instructions before this operation completes. What can be done to prevent any row in sections table to be referenced with sectionId as the value for parentSectionId column while this operation is being carried out?