"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