How to fix Array subscript error in PostgreSQL | DevErrors