Circ errors due to issue with metabib.record_attr_flat view
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Evergreen |
Fix Released
|
High
|
Unassigned | ||
2.6 |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
It would appear that a recent "improve performance" change to metabib.
The problem looks to be the union of queries doing LEFT joins - By being LEFT joins we got null values in attr and value when there we no matches in a given query, which then got passed into hstore which disliked the nulls on attr at least (as far as I can tell).
By removing the LEFT portion of the joins (which brings it back in line to before the "improve performance" commit which did a normal join as well) we remove the NULL entries and the errors go away, hopefully still getting the improved performance.
The branch below makes said change.
summary: |
- Circ errors due to issue with metabib.record_attr_fla view + Circ errors due to issue with metabib.record_attr_flat view |
Changed in evergreen: | |
status: | Fix Committed → Fix Released |
The postgres docs do not suggest that hstore has a problem storing NULL values: http:// www.postgresql. org/docs/ 9.2/static/ hstore. html ... I'd be concerned about a mis-diagnosis here, unless you've found that hstore is truly not acting as documented.
However, if you do want to force the metabib.record_attr view to exclude NULLs, I would recommend this instead:
CREATE VIEW metabib.record_attr AS record_ attr_flat WHERE value IS NOT NULL GROUP BY 1;
SELECT id, HSTORE( ARRAY_AGG( attr ), ARRAY_AGG( value ) ) AS attrs FROM metabib.
That way you're not changing something used by other code without having inspected that other code.