Re: Timing of notice delivery - Mailing list pgsql-jdbc

From Tom Lane
Subject Re: Timing of notice delivery
Date
Msg-id 6364.1296606710@sss.pgh.pa.us
Whole thread Raw
In response to Timing of notice delivery  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
List pgsql-jdbc
"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

pgsql-jdbc by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Timing of notice delivery
Next
From: Oliver Jowett
Date:
Subject: Re: Timing of notice delivery