Skip site navigation (1) Skip section navigation (2)

PGRES_FATAL_ERROR from queries in transaction abort state?

From: Forest Wilkinson <lyris-pg(at)tibit(dot)com>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: PGRES_FATAL_ERROR from queries in transaction abort state?
Date: 2003-05-22 20:58:10
Message-ID: mldqcvkst5usunkue57995ls4cvr46q60b@4ax.com (view raw or flat)
Thread:
Lists: pgsql-interfaces
I am maintaining code that uses libpq, and takes PGRES_FATAL_ERROR to
mean the database connection can no longer be used.  However, this
does not appear to be true in all cases.  I have found that
PGRES_FATAL_ERROR is returned by all queries within a transaction
after any previous query fails.  Unfortunately, I have no good way to
distinguish this situation (which merely requires a ROLLBACK) from an
actual fatal error.  I don't want to parse the text from
PQresultErrorMessage(), because I don't believe it's guaranteed to
remain consistent between versions and locales.  Is there another way
to tell the difference?

Why isn't PGRES_NONFATAL_ERROR returned for queries in an aborted
transaction state?  PGRES_FATAL_ERROR seems like a lie, since the
error is not fatal.


Responses

pgsql-interfaces by date

Next:From: Tom LaneDate: 2003-05-23 00:06:27
Subject: Re: PGRES_FATAL_ERROR from queries in transaction abort state?
Previous:From: Maksim LikharevDate: 2003-05-22 19:22:09
Subject: preserving state across external functions calls

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group