Postgres Function Return Rows Ai Replacing