pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: John Muehlhausen <jgm@jgm.org>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: NOTIFY in multi-statement PQexec() not sent outside of transaction
Date: Mon, 20 Apr 2020 16:10:03 -0400
Message-ID: <7726.1587413403@sss.pgh.pa.us> (raw)
In-Reply-To: <CACk8hr6ir5Vq-oHjHu09ya4fgnnvog1EkX_iaXqttyA15EU+SA@mail.gmail.com>
References: <CACk8hr6At5fr7Qscy8LWT+oBs-_SYw1QvonsAU-6srYHsKuywg@mail.gmail.com>
	<CAKFQuwb4OS74dBshrvB9Zu9V5ik5W2+5ja-tD0ieEK7LwZKWRQ@mail.gmail.com>
	<CACk8hr6qGF78Vo7i7+mvgXqy3AMoOXAkxbCMbGwxwNOf9dpw2Q@mail.gmail.com>
	<14161.1587411720@sss.pgh.pa.us>
	<CACk8hr6ir5Vq-oHjHu09ya4fgnnvog1EkX_iaXqttyA15EU+SA@mail.gmail.com>

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





view thread (10+ messages)  latest in thread

Message-ID: <7726.1587413403@sss.pgh.pa.us>
Permalink:  ../7726.1587413403@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/7726.1587413403@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jgm@jgm.org, david.g.johnston@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: NOTIFY in multi-statement PQexec() not sent outside of transaction
  In-Reply-To: <7726.1587413403@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox