Re: debug a mess

From: Matthew Vanecek <mevanecek(at)yahoo(dot)com>
To: Postgresql Interfaces List <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: debug a mess
Date: 2003-02-25 20:29:56
Message-ID: 1046204996.12261.65.camel@reliant.home.pri
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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...

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Matthew Vanecek 2003-02-25 20:44:45 Re: ECPG and C++ compilation
Previous Message Matthew Vanecek 2003-02-25 20:23:34 Re: Using LISTEN/NOTIFY with ecpg