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

From Tom Lane
Subject Re: NOTIFY in multi-statement PQexec() not sent outside of transaction
Date
Msg-id 7726.1587413403@sss.pgh.pa.us
Whole thread Raw
In response to Re: NOTIFY in multi-statement PQexec() not sent outside of transaction  (John Muehlhausen <jgm@jgm.org>)
Responses Re: NOTIFY in multi-statement PQexec() not sent outside of transaction
List pgsql-bugs
John Muehlhausen <jgm@jgm.org> writes:
> My perspective as a libpq user is that multi-statement PQexec() should have
> the same effects as multiple PQexec() calls other than for the former
> dropping the results of all but the most recent statement.

Well, that's not even close to true, because of the rules about statements
within a multi-statement string getting merged into single transactions.

> As a practical matter, what I was trying to do is signal a test case that
> Postgres is in the middle of processing a transaction string.

I'm not really sure why you want to go about that in this particular way;
under ordinary circumstances the client app wouldn't see the notify until
after PQexec returned, anyway.  (Yes, I realize that there are ways around
that, but still, you can't really do anything with the connection until
PQexec returns.)

Perhaps you could achieve a similar effect using single-row mode,
ie break the connection after collecting a few rows from a multi-row
query?  That's not PQexec at all of course, but if you use PQsendQuery
then the server doesn't know the difference.

            regards, tom lane



pgsql-bugs by date:

Previous
From: John Muehlhausen
Date:
Subject: Re: NOTIFY in multi-statement PQexec() not sent outside of transaction
Next
From: John Muehlhausen
Date:
Subject: Re: NOTIFY in multi-statement PQexec() not sent outside of transaction