Re: PQsendQuery+PQgetResult+PQsetSingleRowMode limitations and support

From: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
To: "Shulgin, Oleksandr" <oleksandr(dot)shulgin(at)zalando(dot)de>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PQsendQuery+PQgetResult+PQsetSingleRowMode limitations and support
Date: 2016-04-11 17:37:34
Message-ID: 20160411123734.118817d6@slate.meme.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 11 Apr 2016 19:25:20 +0200
"Shulgin, Oleksandr" <oleksandr(dot)shulgin(at)zalando(dot)de> wrote:

> On Mon, Apr 11, 2016 at 7:15 PM, Karl O. Pinc <kop(at)meme(dot)com> wrote:

> > > Not sure about the part
> > > where you call PQsetSingleRowMode() again after seeing
> > > PGRES_TUPLES_OK: doesn't look to me like you need or want to do
> > > that. You should only call it immediately after PQsendQuery().
> >
> > You're quite right. All but the first PQsetSingleRowMode()
> > calls fail.
> >
> > This seems unfortunate. What if I submit several SQL statements
> > with one PQsendQuery() call and I only want some of the statements
> > executed in single row mode?
>
> I would assume that if you know for which of the statements you want
> the single row mode, then you as well can submit them as separate
> PQsendQuery() calls.

Agreed. Although I suppose it's possible to know which statements
you want in single row mode but not know how to parse those
statements out of some big string of queries. Not my problem. ;-)

> > When the docs here say "query" what they really mean is "set of
> > statements submitted in a single libpq call".
>
> Which are the same things more or less, I'm not sure that the extended
> explanation you suggest makes it less confusing.

I'll try to remember to cc-you if and when I send in a doc patch
so you can see if there's any improvement.

Regards,

Karl <kop(at)meme(dot)com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2016-04-11 19:08:15 Re: Move PinBuffer and UnpinBuffer to atomics
Previous Message Kevin Grittner 2016-04-11 17:31:09 Re: pgsql: Add the "snapshot too old" feature