Support postgresql

Clean up the code so postgresql works now, and display cumulative rain
information