evergreen.protect_reserved_rows_from_delete() trigger function returning error

Bug #1533331 reported by Chris Sharp on 2016-01-12
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

The fix for bug 1513554 included creating a general trigger function to prevent the deletion of reserved table rows with an ID lower than a specified threshold. Testing for that seemed to pass muster, but I'm now seeing a problem when deleting rows that *can* be deleted (i.e., with IDs higher than the threshold). Steps:

1) create a new Acquisitions cancel reason by going to Admin -> Acquisitions Administration -> Cancel Reasons and clicking "New Cancel Reason".

2) check the box beside the new reason and click "Delete Selected".

Expected behavior is that the screen removes the deleted reason from the list. What happens is nothing. The error message in the logs is:

ERROR: control reached end of trigger procedure without RETURN
CONTEXT: PL/pgSQL function protect_reserved_rows_from_delete()
STATEMENT: DELETE FROM acq.cancel_reason WHERE id = 2142;

I'm working on a fix right now.

Evergreen 2.9 through current master
OpenSRF current
PostgreSQL 9.4
Ubuntu 14.04

Changed in evergreen:
importance: Undecided → High
assignee: nobody → Chris Sharp (chrissharp123)
Jason Stephenson (jstephenson) wrote :

Well, with master from this morning, and a pile of other stuff not related to acquisitions, I can't even click the check boxes and make them stick. So, I'll agree that there is definitely something wrong there, but I can't exactly reproduce this issue.

Jason Stephenson (jstephenson) wrote :

I get slightly different staff client behavior in master, but I can confirm the log messages and the failure to delete the cancel reasons.

I also noticed that my newly created cancel_reasons were getting ids in the 1690-range and not 2000+. I wonder if this is an upgrade script issue?

Once I changed the ids to being over 2000, I was able to reproduce the issue described by Chris, except that the selected cancel reason never disappeared from the list when I pressed Delete Selected.

I'll try the patch and see what happens after that.

Changed in evergreen:
status: New → Confirmed
milestone: none → 2.10-rc
Jason Stephenson (jstephenson) wrote :

It works for me.

Pushed to master, rel_2_10, and rel_2_9.

Thanks, Chris!

Changed in evergreen:
status: Confirmed → Fix Committed
assignee: Chris Sharp (chrissharp123) → nobody
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers