dblink generates orphaned connections when called with a connection string,
fail_on_error = true, and an ERROR occurs. Discovery and patch by
Tatsuhito Kasahara. Introduced in 8.4.
(PQresultStatus(res) != PGRES_COMMAND_OK &&
PQresultStatus(res) != PGRES_TUPLES_OK))
{
- dblink_res_error(conname, res, "could not execute query", fail);
if (freeconn)
PQfinish(conn);
+ dblink_res_error(conname, res, "could not execute query", fail);
MemoryContextSwitchTo(oldcontext);
SRF_RETURN_DONE(funcctx);
}