In my case I simply stopped and then started the service and that solved my problem.
1. brew services stop postgresql 2. brew services start postgresql