Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 8E9A01337B58 for ; Tue, 1 Feb 2011 20:31:57 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 83959-04 for ; Wed, 2 Feb 2011 00:31:51 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 2C2641337B54 for ; Tue, 1 Feb 2011 20:31:50 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p120Voh2006365; Tue, 1 Feb 2011 19:31:50 -0500 (EST) To: "Kevin Grittner" cc: pgsql-jdbc@postgresql.org Subject: Re: Timing of notice delivery In-reply-to: <4D484825020000250003A151@gw.wicourts.gov> References: <4D484825020000250003A151@gw.wicourts.gov> Comments: In-reply-to "Kevin Grittner" message dated "Tue, 01 Feb 2011 17:51:33 -0600" Date: Tue, 01 Feb 2011 19:31:50 -0500 Message-ID: <6364.1296606710@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201102/5 X-Sequence-Number: 21403 "Kevin Grittner" 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