refactor postgresql postgres into client/server modules