How to fix cursor already exists in PostgreSQL | DevErrors