Fix some potential DataIntegrityProblemException sources (dist)
This also fixes some lint issues.
merge-overlap: See #19627 reltoolbox: See #23074, #23077, #23123