<para>
The connection reset event is fired on completion of
<xref linkend="libpq-PQreset"/> or <function>PQresetPoll</function>. In
- both cases, the event is only fired if the reset was successful. If
- the event procedure fails, the entire connection reset will fail; the
- <structname>PGconn</structname> is put into
- <literal>CONNECTION_BAD</literal> status and
- <function>PQresetPoll</function> will return
- <literal>PGRES_POLLING_FAILED</literal>.
+ both cases, the event is only fired if the reset was successful.
+ The return value of the event procedure is ignored
+ in <productname>PostgreSQL</productname> v15 and later.
+ With earlier versions, however, it's important to return success
+ (nonzero) or the connection will be aborted.
<synopsis>
typedef struct
if (connectDBStart(conn) && connectDBComplete(conn))
{
/*
- * Notify event procs of successful reset. We treat an event proc
- * failure as disabling the connection ... good idea?
+ * Notify event procs of successful reset.
*/
int i;
PGEventConnReset evt;
evt.conn = conn;
- if (!conn->events[i].proc(PGEVT_CONNRESET, &evt,
- conn->events[i].passThrough))
- {
- conn->status = CONNECTION_BAD;
- appendPQExpBuffer(&conn->errorMessage,
- libpq_gettext("PGEventProc \"%s\" failed during PGEVT_CONNRESET event\n"),
- conn->events[i].name);
- break;
- }
+ (void) conn->events[i].proc(PGEVT_CONNRESET, &evt,
+ conn->events[i].passThrough);
}
}
}
if (status == PGRES_POLLING_OK)
{
/*
- * Notify event procs of successful reset. We treat an event proc
- * failure as disabling the connection ... good idea?
+ * Notify event procs of successful reset.
*/
int i;
PGEventConnReset evt;
evt.conn = conn;
- if (!conn->events[i].proc(PGEVT_CONNRESET, &evt,
- conn->events[i].passThrough))
- {
- conn->status = CONNECTION_BAD;
- appendPQExpBuffer(&conn->errorMessage,
- libpq_gettext("PGEventProc \"%s\" failed during PGEVT_CONNRESET event\n"),
- conn->events[i].name);
- return PGRES_POLLING_FAILED;
- }
+ (void) conn->events[i].proc(PGEVT_CONNRESET, &evt,
+ conn->events[i].passThrough);
}
}