Fix "before delete" trigger on Scheduling Specification Conditions #1631
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
If a "before" trigger returns
NULL
, the operation is cancelled, as per the Postgres Documentation.Since
new
is not defined in adelete
trigger, the trigger would always returnnull
, cancelling the deletion. This made it impossible to remove scheduling conditions from a plan's specification.Verification
Bryan tested the new code and proved that it fixed the bug.
Additionally, I searched for all instances of "before delete" triggers, since this is not an issue with "after" triggers (from the docs "The return value is ignored for row-level triggers fired after an operation, and so they can return NULL."). The regex search I used was
before .*delete
.Future work
Nowhere near the scope of this ticket, but the fact that it took just over a year for this bug to be observed gives the impression that Scheduling Conditions aren't used that often. Given the current work to increase the power of goals and constraints, I think they may end up obsoleting conditions entirely.