Re: We have to close the cursor or rollback the transaction in case of failure?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: We have to close the cursor or rollback the transaction in case of failure?
Дата
Msg-id 13187.1575558311@sss.pgh.pa.us
обсуждение исходный текст
Ответ на We have to close the cursor or rollback the transaction in case offailure?  (M Tarkeshwar Rao <m.tarkeshwar.rao@ericsson.com>)
Список pgsql-general
M Tarkeshwar Rao <m.tarkeshwar.rao@ericsson.com> writes:
> I am using cursors to fetch the data from table using  C++. Initially were errors as highlighted  as "current
transactionisaborted" in /var/logs during full vacuum. 
> We are little bit confused in failure handling. In case of any failure of following function.
> PQexec(connection, myFetchSql)
> We have to close the cursor or rollback the transaction?

Once the transaction has had an error, you have to issue ROLLBACK
before you can do anything else.  That will automatically close
any cursors opened in the current transaction.  There's no point
in issuing an explicit CLOSE (and indeed, if you try, it'll just
produce the same "current transaction is aborted" error).

            regards, tom lane



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

Предыдущее
От: "Zwettler Markus (OIZ)"
Дата:
Сообщение: AW: archiving question
Следующее
От: Melvin Davidson
Дата:
Сообщение: Re: Schema Copy