Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "before delete" trigger on Scheduling Specification Conditions #1631

Merged
merged 1 commit into from
Jan 29, 2025

Conversation

Mythicaeda
Copy link
Contributor

  • Tickets addressed: AERIE-000
  • Review: By commit
  • Merge strategy: Merge (no squash)

Description

If a "before" trigger returns NULL, the operation is cancelled, as per the Postgres Documentation.

Since new is not defined in a delete trigger, the trigger would always return null, 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.

If a "before" trigger returns `NULL`, the operation is cancelled, as per the Postgres Documentation (https://www.postgresql.org/docs/16/trigger-definition.html).
@Mythicaeda Mythicaeda added bug Something isn't working fix A bug fix database Anything related to the database labels Jan 28, 2025
@Mythicaeda Mythicaeda requested a review from mattdailis January 28, 2025 22:51
@Mythicaeda Mythicaeda self-assigned this Jan 28, 2025
@Mythicaeda Mythicaeda requested a review from a team as a code owner January 28, 2025 22:51
@Mythicaeda Mythicaeda requested a review from joswig January 28, 2025 22:51
@Mythicaeda Mythicaeda requested review from JoelCourtney and removed request for joswig January 28, 2025 22:55
@Mythicaeda Mythicaeda merged commit 1388d24 into develop Jan 29, 2025
29 checks passed
@Mythicaeda Mythicaeda deleted the fix/before-delete-return-old branch January 29, 2025 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working database Anything related to the database fix A bug fix
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants