Dynamic Query In Postgresql Function Example