/*
 * call-seq:
 *    conn.get_notify()
 *
 * Returns an array of the unprocessed notifiers.
 * If there is no unprocessed notifier, it returns +nil+.
 */
static VALUE
pgconn_get_notify(obj)
  VALUE obj;
{
  PGnotify *notify;
  VALUE ary;

  /* gets notify and builds result */
  notify = PQnotifies(get_pgconn(obj));
  if (notify == NULL) {
    /* there are no unhandled notifications */
    return Qnil;
  }
  ary = rb_ary_new3(2, rb_tainted_str_new2(notify->relname),
        INT2NUM(notify->be_pid));
  free(notify);

  /* returns result */
  return ary;
}