Commit 8af3596d authored by Joe Conway's avatar Joe Conway

Async dblink functions require a named connection, and therefore should

use DBLINK_GET_NAMED_CONN rather than DBLINK_GET_CONN.
Problem found by Peter Eisentraut and patch by Fujii Masao.
parent eb03cff8
...@@ -613,16 +613,13 @@ Datum ...@@ -613,16 +613,13 @@ Datum
dblink_send_query(PG_FUNCTION_ARGS) dblink_send_query(PG_FUNCTION_ARGS)
{ {
PGconn *conn = NULL; PGconn *conn = NULL;
char *connstr = NULL;
char *sql = NULL; char *sql = NULL;
remoteConn *rconn = NULL; remoteConn *rconn = NULL;
char *msg;
bool freeconn = false;
int retval; int retval;
if (PG_NARGS() == 2) if (PG_NARGS() == 2)
{ {
DBLINK_GET_CONN; DBLINK_GET_NAMED_CONN;
sql = text_to_cstring(PG_GETARG_TEXT_PP(1)); sql = text_to_cstring(PG_GETARG_TEXT_PP(1));
} }
else else
...@@ -711,13 +708,13 @@ dblink_record_internal(FunctionCallInfo fcinfo, bool is_async) ...@@ -711,13 +708,13 @@ dblink_record_internal(FunctionCallInfo fcinfo, bool is_async)
if (PG_NARGS() == 2) if (PG_NARGS() == 2)
{ {
/* text,bool */ /* text,bool */
DBLINK_GET_CONN; DBLINK_GET_NAMED_CONN;
fail = PG_GETARG_BOOL(1); fail = PG_GETARG_BOOL(1);
} }
else if (PG_NARGS() == 1) else if (PG_NARGS() == 1)
{ {
/* text */ /* text */
DBLINK_GET_CONN; DBLINK_GET_NAMED_CONN;
} }
else else
/* shouldn't happen */ /* shouldn't happen */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment