Skip to content
New issue

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

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

Already on GitHub? # to your account

bug(session): null fkey trigger also checks for session terminated state #2065

Merged
merged 1 commit into from
May 12, 2022

Conversation

irenarindos
Copy link
Collaborator

Function cancel_session() cancels sessions on deletion of foreign key constraints. It checked whether a session was in a canceling state but not terminated (sessions can transition to terminated without going through canceling).
This update adds a check for a terminated state to prevent attempts to cancel already terminated sessions.

Fixes #2064

-- cancel_session will insert a cancel state for the session, if there's isn't
-- a canceled or terminated state already. It's used by cancel_session_with_null_fk.
create function
cancel_session(in sessionId text) returns void
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add unit tests for this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I should have been more clear. I was thinking the unit tests would be added to our sql test suite since this is a sql function. Would it be possible to add unit tests there?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@irenarindos irenarindos requested a review from mgaffney May 9, 2022 15:07
@jefferai jefferai added this to the 0.8.1 milestone May 11, 2022
@irenarindos irenarindos force-pushed the irindos-session-nullfkey branch 2 times, most recently from cfcae0b to 8b9e2d9 Compare May 12, 2022 16:24
mgaffney
mgaffney previously approved these changes May 12, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Foreign key constraint violation when targets.(Service).deleteFromRepo
3 participants