Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ewqnU-0003YN-D4 for pgsql-sql@arkaria.postgresql.org; Fri, 16 Mar 2018 14:57:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ewqnT-0003ib-EA for pgsql-sql@arkaria.postgresql.org; Fri, 16 Mar 2018 14:57:31 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ewqnT-0003iR-4C for pgsql-sql@lists.postgresql.org; Fri, 16 Mar 2018 14:57:31 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ewqnQ-0006M8-6G for pgsql-sql@postgresql.org; Fri, 16 Mar 2018 14:57:29 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w2GEvJ5R019762; Fri, 16 Mar 2018 10:57:20 -0400 From: Tom Lane To: abctevez cc: pgsql-sql@postgresql.org Subject: Re: does the notification of postgres appear in transaction completed order In-reply-to: <3bc63b9d.f064.1622f0c0a46.Coremail.swqshapu@163.com> References: <3bc63b9d.f064.1622f0c0a46.Coremail.swqshapu@163.com> Comments: In-reply-to abctevez message dated "Fri, 16 Mar 2018 21:42:20 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <19760.1521212239.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 16 Mar 2018 10:57:19 -0400 Message-ID: <19761.1521212239@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk abctevez writes: > I want to use notify/listen to catch the message that a transaction comp= leted.Fire notify in trigger and as the official said, it won't notify if = transaction rollback.However, I am wondering if the message appear in the = same order with transaction execution.I couldn't find this topic on the of= ficial web or just I missed it? https://www.postgresql.org/docs/current/static/sql-notify.html says Except for dropping later instances of duplicate notifications, NOTIFY guarantees that notifications from the same transaction get delivered in the order they were sent. It is also guaranteed that messages from different transactions are delivered in the order in which the transactions committed. regards, tom lane