Fix sgp.sqlite logic in analyzeSGP and update testSGP(4) to current use cases