From c390daed0fc992dec15ec86cb709e86505287fc6 Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Mon, 9 Jan 2017 14:02:45 -0800 Subject: [PATCH] Use interrupt checking libpq wrappers in router executor. --- .../executor/multi_router_executor.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/backend/distributed/executor/multi_router_executor.c b/src/backend/distributed/executor/multi_router_executor.c index bf04d1f81..9067d748f 100644 --- a/src/backend/distributed/executor/multi_router_executor.c +++ b/src/backend/distributed/executor/multi_router_executor.c @@ -1168,13 +1168,12 @@ SendQueryInSingleRowMode(MultiConnection *connection, char *query, ExtractParametersFromParamListInfo(paramListInfo, ¶meterTypes, ¶meterValues); - querySent = PQsendQueryParams(connection->pgConn, query, - parameterCount, parameterTypes, parameterValues, - NULL, NULL, 0); + querySent = SendRemoteCommandParams(connection, query, parameterCount, + parameterTypes, parameterValues); } else { - querySent = PQsendQuery(connection->pgConn, query); + querySent = SendRemoteCommand(connection, query); } if (querySent == 0) @@ -1307,8 +1306,9 @@ StoreQueryResult(MaterialState *routerState, MultiConnection *connection, uint32 rowCount = 0; uint32 columnCount = 0; ExecStatusType resultStatus = 0; + bool doRaiseInterrupts = true; - PGresult *result = PQgetResult(connection->pgConn); + PGresult *result = GetRemoteCommandResult(connection, doRaiseInterrupts); if (result == NULL) { break; @@ -1410,13 +1410,14 @@ ConsumeQueryResult(MultiConnection *connection, bool failOnError, int64 *rows) *rows = 0; /* - * Due to single row mode we have to do multiple PQgetResult() to finish - * processing of this query, even without RETURNING. For single-row mode - * we have to loop until all rows are consumed. + * Due to single row mode we have to do multiple GetRemoteCommandResult() + * to finish processing of this query, even without RETURNING. For + * single-row mode we have to loop until all rows are consumed. */ while (true) { - PGresult *result = PQgetResult(connection->pgConn); + const bool doRaiseInterrupts = true; + PGresult *result = GetRemoteCommandResult(connection, doRaiseInterrupts); ExecStatusType status = PGRES_COMMAND_OK; if (result == NULL)