Solving Problems Using Array Functions Postgres