Re: debug a mess - Mailing list pgsql-interfaces

From Matthew Vanecek
Subject Re: debug a mess
Date
Msg-id 1046204996.12261.65.camel@reliant.home.pri
Whole thread Raw
In response to debug a mess  (Wei Weng <wweng@kencast.com>)
List pgsql-interfaces
On Tue, 2003-02-25 at 12:41, Wei Weng wrote:
> I am trying to figure out where the "NOTICE:  current transaction is aborted,
> queries ignored until end of transaction block" comes from in my code.
> Basically, this is what it does:
>
> CString strQuery
> = "SELECT datname FROM pg_database WHERE name = 'mydatabase'";
>
> if (NULL == (res = PQexec(pgconn, (CSTR) strQuery)))
> {
>     ErrorQuit(PQerrorMessage(pgconn));
> }
>
> It is really very simple code, but each time I try to run it, the postgresql
> backend gives me the "transaction aborted" error message. I checked the
> mailing list archive, and Tom once explained that the reason for this error
> message is the backend had quitted for some reason. Is there anyway to see
> why the backend aborted the transaction?? It could be really helpful.
>

It sounds like you've executed a query or command, and have not called
PQclear(result) on the results.  Whenever I've gottten that error, not
clearing the results has always been the root cause.  Make sure result
is not NULL first, of course...


--
Matthew Vanecek
perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'
********************************************************************************
For 93 million miles, there is nothing between the sun and my shadow except me.
I'm always getting in the way of something...

pgsql-interfaces by date:

Previous
From: Matthew Vanecek
Date:
Subject: Re: Using LISTEN/NOTIFY with ecpg
Next
From: Matthew Vanecek
Date:
Subject: Re: ECPG and C++ compilation