PostgreSQL storage backend tests

Expand test suite for PostgreSQL storage backend and fix a bug that
expanded coverage detected.