Koha How-To
Koha 17.05 Upgrade Issues with the biblioitems.marcxml table
Hello Partners!
We wanted to let you know about a potential issue with the upcoming Koha 17.05 update. A database change was made in Koha 17.05 that breaks reports using the biblioitems.marcxml field.
First of all, we want you to know that we’ve got you covered, and we are working behind the scenes to get these reports fixed for all partners who are affected by this issue.
In this post we’ll tell you more about what caused this issue, show you how you can fix the issue yourself if you would like to, and let you know what we’re doing to fix this for you.
Converting queries with biblioitems.marcxml to biblio_metadata.metadata.
Clicking the Update SQL button brings up a window which will allow the user to inspect the changes to the query, and accept the changes by clicking update if they’re acceptable.The Update SQL button will replace every occurrence of biblioitems with biblio_metadata and every marcxml with metadata. This will work perfectly as long as marcxml is the only field used from the biblioitems table.
Update SQL works with this query:
SELECT biblio.title, ExtractValue(biblioitems.marcxml,'//controlfield[@tag="001"] ') AS "field_001" FROM biblio LEFT JOIN biblioitems USING (biblionumber)
will be converted to
SELECT biblio.title, ExtractValue(biblio_metadata.metadata,'//controlfield[@tag=" 001"]') AS "field_001" FROM biblio LEFT JOIN biblio_metadata USING (biblionumber)
Update SQL won’t work here:
Adding an extra field, like ISBN spoils the party.
SELECT biblio.title, biblioitems.isbn, ExtractValue(biblioitems.marcxml,'//controlfield[@tag="001"] ') AS "field_001", FROM biblio LEFT JOIN biblioitems USING (biblionumber)
… because the metadata table does not contain an ISBN column, this query will fail:
SELECT biblio.title, metadata.isbn, ExtractValue(biblio_metadata.metadata,'//controlfield[@tag=" 001"]') AS "field_001", FROM biblio LEFT JOIN biblio_metadata USING (biblionumber)
So, these queries will need to be adjusted by hand.
Editing the query by hand
Any biblioitems columns other than marcxml or biblionumber must be called from the biblioitems table i.e. biblioitems.isbn stays biblioitems.isbn. Both the biblio_metadata and biblioitems need to be joined in order for the columns to be available. You should be fairly safe copying the biblioitems join, then changing biblioitems to biblio_metadata.
LEFT JOIN biblioitems USING (biblionumber)
Becomes…
LEFT JOIN biblioitems USING (biblionumber) LEFT JOIN biblio_metadata USING (biblionumber)
The edited query looks like this:
SELECT biblio.title, biblioitems.isbn, ExtractValue(biblio_metadata.metadata,'//controlfield[@tag="001"]') AS "field_001", FROM biblio LEFT JOIN biblio_metadata USING (biblionumber) LEFT JOIN biblioitems USING (biblionumber)
Our Plan for Upgrading Reports
- Which queries can be safely fixed by clicking the UPGRADE SQL button.
- Which queries we will fix by hand on the day of the upgrade — essentially, any queries that have run in the last 6 weeks.
- Which queries remain that need to be fixed by hand. We will fix these within a month of your upgrade.
If you need any reports fixed sooner than scheduled, just open a ticket and we will fix that report for you right away.
Read more by Barton Chittenden