Adding better assertion for PostgreSQL connectivity

plus some extra logging for clarity.