Re: BUG #5697: Infinite loop inside PQexecStart function

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #5697: Infinite loop inside PQexecStart function
Дата
Msg-id 29983.1286466266@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #5697: Infinite loop inside PQexecStart function  ("Boris" <admin@nyc.yamaha.com>)
Ответы Re: BUG #5697: Infinite loop inside PQexecStart function
Список pgsql-bugs
"Boris" <admin@nyc.yamaha.com> writes:
> while ((result = PQgetResult(conn)) != NULL){
>     ExecStatusType resultStatus = result->resultStatus;
>     PQclear(result); /* only need its status */
>     /* check for loss of connection, too */
>     if (result->resultStatus == PGRES_COPY_IN ||
>                          result->resultStatus == PGRES_COPY_OUT ||
>                          conn->status == CONNECTION_BAD)
>                          break;
>     }

This code is broken: once you've done PQclear() it's unsafe to access
the PGresult.  I think you meant just "resultStatus" not
"result->resultStatus" in the if().

            regards, tom lane

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "Boris"
Дата:
Сообщение: BUG #5697: Infinite loop inside PQexecStart function
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #5697: Infinite loop inside PQexecStart function