Indexer can fail when calculating subcontainer_barcodes


This one is a bit complicated, so bear with me.... It affects 2.80

A newly added method: calls which in turn calls which finally calls

In that method, there is a sort_by which can fail since the aspace_relationship_position column in the top_container_link_rlshp table can be NULL, leading to an error of 'comparison of NilClass with X failed' in the indexer process.

I'm not sure of a great way to fix this. I'm not entirely sure what that column is used for in this table, so I'm not sure what the ramifications might be if it were (for example) to be updated to disallow NULL.




Lora Woodford
8 days ago

Hi - Can you provide a bit more information on how you ended up with a NULL in aspace_relationship_position? I can’t seem to replicate this in the UI, but I might be missing something obvious. Are you aware of how your nulls came into being?

We could likely add a .to_i in the find_by_participant method (essentially making nulls into 0’s), but I’d rather have a regularly failing example to test against/write tests against before going down this path.


Joshua Shaw
8 days ago

Hi Its an edge case for sure since I noticed the issue while writing a custom data migration to do some cleanup. Had I gone through the API, it wouldn't have been an issue, but I used a migration since the completion time is much faster and I was processing several hundred thousand rows. In doing that, I noticed that I could build db objects that met all of the db constraints, but that caused the above failure. I can provide more detail on the migration, but its very niche to our instance.




Joshua Shaw


Affects versions