Re: NOTIFY in multi-statement PQexec() not sent outside of transaction - Mailing list pgsql-bugs

From John Muehlhausen
Subject Re: NOTIFY in multi-statement PQexec() not sent outside of transaction
Date
Msg-id CACk8hr6qGF78Vo7i7+mvgXqy3AMoOXAkxbCMbGwxwNOf9dpw2Q@mail.gmail.com
Whole thread Raw
In response to Re: NOTIFY in multi-statement PQexec() not sent outside of transaction  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: NOTIFY in multi-statement PQexec() not sent outside of transaction
List pgsql-bugs
Wrapping the notify in a transaction does not fix it.  Shouldn't the notify be available as soon as the containing transaction is committed?

cur.execute(("begin; notify __test; commit; "
                "begin; select pg_advisory_lock(7777); "
                "select pg_advisory_unlock(7777); commit"))


On Mon, Apr 20, 2020 at 1:26 PM David G. Johnston <david.g.johnston@gmail.com> wrote:
On Monday, April 20, 2020, John Muehlhausen <jgm@jgm.org> wrote:

# docs seem to indicate that an implied transaction
# will not exist if there is an explicit begin/commit?
cur.execute(("notify __test; "
"begin; select pg_advisory_lock(7777); "
"select pg_advisory_unlock(7777); commit"))


A more comprehensive reading of the docs finds:

“ If the BEGIN follows some statements that were executed as an implicit transaction block, those statements are not immediately committed; in effect, they are retroactively included into the new regular transaction block. “.

David J.

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #16112: large, unexpected memory consumption
Next
From: Tom Lane
Date:
Subject: Re: NOTIFY in multi-statement PQexec() not sent outside of transaction