Handling error during async query

Поиск
Список
Период
Сортировка
От Daniele Varrazzo
Тема Handling error during async query
Дата
Msg-id CA+mi_8Y-a_H+w28T+y0Z1BEopVCgxc4x1xSugps6znAMBGgnwg@mail.gmail.com
обсуждение исходный текст
Список pgsql-general
Hello,

I'm trying to fix psycopg2 issue #113: network disconnection not
handled correctly in async mode.

If I'm in the middle between the PQsendQuery and the PQgetResult and
an error is detected (let's say we don't know yet if
application-related or connection-related), is there a way to abort
the query and put it back in a status where PQsendQuery can be
executed again (I believe transaction status from ACTIVE to IDLE)
without fetching the result?

Psycopg currently tries to fetch (blocking) and discard the result
after an error:

    while (NULL != (res = PQgetResult(conn->pgconn))) {
        PQclear(res);
    }

but if the network connection has gone down it will result in waiting
forever. Not to mention the fact the operation is blocking when the
user wanted nonblocking operations.


-- Daniele

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

Предыдущее
От: "James W. Wilson"
Дата:
Сообщение: Re: problem with dblink and "drop owned by"
Следующее
От: "Bob Pawley"
Дата:
Сообщение: Re: Trouble with NEW