result_error_field (PGresult)

    /*
     * call-seq:
     *    res.result_error_field(fieldcode) -> String
     *
     * Returns the individual field of an error.
     *
     * +fieldcode+ is one of:
     * * +PG_DIAG_SEVERITY+
     * * +PG_DIAG_SQLSTATE+
     * * +PG_DIAG_MESSAGE_PRIMARY+
     * * +PG_DIAG_MESSAGE_DETAIL+
     * * +PG_DIAG_MESSAGE_HINT+
     * * +PG_DIAG_STATEMENT_POSITION+
     * * +PG_DIAG_INTERNAL_POSITION+
     * * +PG_DIAG_INTERNAL_QUERY+
     * * +PG_DIAG_CONTEXT+
     * * +PG_DIAG_SOURCE_FILE+
     * * +PG_DIAG_SOURCE_LINE+
     * * +PG_DIAG_SOURCE_FUNCTION+
     */
    static VALUE
    pgresult_result_error_field(VALUE self, VALUE field)
    {
            PGresult *result = get_pgresult(self);
            int fieldcode = NUM2INT(field);
            return rb_tainted_str_new2(PQresultErrorField(result,fieldcode));
    }