wrong default join type for config.rule_age_hold_protection in reports

Bug #1419813 reported by Chris Sharp on 2015-02-09
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Medium
Unassigned

Bug Description

In fm_IDL.xml, which config.rule_age_hold_protection is linked to several sources with a "rel" attribute of "has_a", but this should be "might_have" since age protection is optional. This was found when a PINES library director noticed that non-age-protected items were being excluded from a regular report.

Branch with proposed fix forthcoming.

Evergreen 2.7.2 (through master)
OpenSRF 2.4
PostgreSQL 9.3
Ubuntu 12.04/14.04

Chris Sharp (chrissharp123) wrote :
Changed in evergreen:
importance: Undecided → Medium
assignee: nobody → Chris Sharp (chrissharp123)
milestone: none → 2.7.4
tags: added: pullrequest reports
Galen Charlton (gmc) wrote :

Pushed to master, rel_2_6, and rel_2_7. Thanks, Chris!

Changed in evergreen:
assignee: Chris Sharp (chrissharp123) → Galen Charlton (gmc)
status: New → Confirmed
status: Confirmed → Fix Committed
assignee: Galen Charlton (gmc) → nobody
Galen Charlton (gmc) wrote :

Following discussion on #evergreen (http://irc.evergreen-ils.org/evergreen/2015-02-23#i_158837), "might_have" doesn't end up producing the left join that is desired, so I've done as requested and pushed a revert to master, rel_2_6, and rel_2_7.

tags: removed: pullrequest
Changed in evergreen:
milestone: 2.7.4 → none
Galen Charlton (gmc) on 2015-02-23
Changed in evergreen:
status: Fix Committed → Confirmed
Chris Sharp (chrissharp123) wrote :

I'd like to add my apologies for insufficient testing of this patch before submitting it here. My cursory initial tests were fine, but building another template revealed this issue.

Thanks, Galen.

Chris

Galen Charlton (gmc) wrote :

Well, if there is in fact a bit of egg on your face, there is on mine too.

Chris Sharp (chrissharp123) wrote :

Thanks again, Galen.

Well, moving onwards, though, I'd like to reframe this ticket to be broader than "the IDL has the wrong join type".

The problem at this point is that "has_a" is conceptually incorrect here because not every item has an entry in config.rule_age_hold_protect, but changing that to "might_have" causes the SQL builder (either in the JS or Perl layer) to join on crahp.id = asset.copy.id (or reporter.classic_item_list.id) which is obviously wrong and ignores the IDL.

The suggested workaround was to keep the "rel" type as "has_a" and use nullability to force the correct join. But when I tried that, it only allows "Parent" nullability (e.g., a RIGHT OUTER LOIN) when what's needed is a LEFT (OUTER) JOIN. So until this is fixed, there is not a way to create a report template that will display hold age protection rules correctly.

While this is the only instance of this issue I've seen, I would suspect the problem is more widespread.

no longer affects: evergreen/2.6
Andrea Neiman (aneiman) on 2018-01-19
no longer affects: evergreen/2.8
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers