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

Tom Lane <[email protected]>
Newsgroups gmane.comp.db.postgresql.general
Message-ID <[email protected]>
M Tarkeshwar Rao <[email protected]> writes:
> I am using cursors to fetch the data from table using  C++. Initially were errors as highlighted  as "current transaction isaborted" 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.