More sql partial work. Better error handling.
Test duplicate hash.