Re: 31.11. Notice Processing - associating notices with calls - Mailing list pgsql-general

From Tom Lane
Subject Re: 31.11. Notice Processing - associating notices with calls
Date
Msg-id 22094.1340636823@sss.pgh.pa.us
Whole thread Raw
In response to 31.11. Notice Processing - associating notices with calls  (Pawel Veselov <pawel.veselov@gmail.com>)
Responses Re: 31.11. Notice Processing - associating notices with calls
List pgsql-general
Pawel Veselov <pawel.veselov@gmail.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

pgsql-general by date:

Previous
From: Vibhor Kumar
Date:
Subject: Re: UFS2 Snapshots and Postgres
Next
From: Merlin Moncure
Date:
Subject: Re: row_to_json question