Postgres Function Check If You Have Collections