Re: libpq: why only one PQsendQuery per connection at a time?

From: Dmitry Igrishin <dmitigr(at)gmail(dot)com>
To: sftf <sftf-misc(at)mail(dot)ru>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: libpq: why only one PQsendQuery per connection at a time?
Date: 2015-01-04 20:22:43
Message-ID: CAAfz9KNkZFiJK3SneJ0VKXjC2Bb1PWSLpamWvp8qrQbUQv77gA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2015-01-04 19:02 GMT+03:00 <sftf-misc(at)mail(dot)ru>:

> Hello!
> Question generally to (libpq) developers.
>
> According to http://www.postgresql.org/docs/9.4/static/libpq-async.html:
> "PQsendQuery cannot be called again (on the same connection) until
> PQgetResult
> has returned a null pointer, indicating that the command is done."
>
> As I guess this is also true for all PQsend* functions, like
> PQsendQueryPrepared,
> although this is not explicitly stated in the documentation.
>
> So question is why this limitaion exists?
>
Because it's violates the protocol -- sending messages like Parse or Bind
to the backend
until the CommandComplete or ErrorResponse consumed by the frontend is
wrong.
See - http://www.postgresql.org/docs/9.4/static/protocol-flow.html

> Why PQgetResult(PGconn *conn) operates on connection,
> and not on some unique handler that each "PQsend*" could return.
>
It does not make sense because of the message flow described by the
protocol.

>
> Is it limitaion of libpq or architecture of postgresql backend or
> backend-frontend protocol?
>
> PS. If you need pipelining take a look at the thread "libpq pipelining"
in hackers-.

--
// Dmitry.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Josh Berkus 2015-01-04 22:31:27 Meetups in New Zealand Jan 12 to 20
Previous Message David G Johnston 2015-01-04 17:45:38 Re: libpq: why only one PQsendQuery per connection at a time?