Re: 31.11. Notice Processing - associating notices with calls

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Pawel Veselov <pawel(dot)veselov(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: 31.11. Notice Processing - associating notices with calls
Date: 2012-06-25 15:07:03
Message-ID: 22094.1340636823@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Pawel Veselov <pawel(dot)veselov(at)gmail(dot)com> writes:
> What's the best way to "associate" an incoming notice with the statement
> that resulted in generating it?

Um ... the first issue with this problem statement is the assumption
that there *is* a statement that caused the notice. The server is
capable of generating notices autonomously, for example during a forced
database shutdown. But having said that, you could certainly keep track
of which command you last issued.

> Notice operate on PGResult objects, but
> these objects only become available after the statement call is made.

I think you are misunderstanding the notice receiver API. The PGresult
that's passed to the receiver is just a transient one created to hold
the notice message's fields. It has nothing to do with the PGresult
generated to hold the eventual result of the current query (if any).

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Vibhor Kumar 2012-06-25 15:09:12 Re: UFS2 Snapshots and Postgres
Previous Message Haszlakiewicz, Eric 2012-06-25 14:59:06 Re: retrieving function raise messages in ecpg embedded sql code