How to fix Duplicate cursor in PostgreSQL | DevErrors