From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kevin Grittner <Kevin.Grittner@wicourts.gov>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Timing of notice delivery
Date: Tue, 01 Feb 2011 19:31:50 -0500
Message-ID: <6364.1296606710@sss.pgh.pa.us> (raw)
In-Reply-To: <4D484825020000250003A151@gw.wicourts.gov>
References: <4D484825020000250003A151@gw.wicourts.gov>
"Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
> In other words, all on one thread, all on one connection:
> -- setup
> Execute LISTEN on the connection.
> conn.setAutoCommit(false);
> -- each transaction
> execute statements which fire triggers which NOTIFY.
> conn.commit();
> conn.getNotifications();
> Can I count on all notifications triggered during a transaction
> being delivered in the last step?
The backend will deliver all such notifies after returning the COMMIT's
command-complete response message, but before it delivers ReadyForQuery.
If JDBC waits for ReadyForQuery before believing the operation is
complete, you should see them reliably.
I believe that the situation for incoming notifies from other sessions
is a bit less predictable, though --- it looks like those can get sent
*after* ReadyForQuery, even if they arrived beforehand.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: tgl@sss.pgh.pa.us, Kevin.Grittner@wicourts.gov
Subject: Re: Timing of notice delivery
In-Reply-To: <6364.1296606710@sss.pgh.pa.us>
References: <4D484825020000250003A151@gw.wicourts.gov> <6364.1296606710@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox