Postgres Select Function In C