Hi David,
I tried to put some of this useful information in the Moodle Docs page at https://docs.moodle.org/29/en/Installing_plugins#Default_exception_handler:_Error_writing_to_database_Debug:_Duplicate_entry_.27en_us-...
Can you please have a look at it and correct/expand/move as needed?
Thanks once more