send Describe Portal message in PQsendPrepare

Started by Manlio Perilloabout 13 years ago3 messageshackers
Jump to latest
#1Manlio Perillo
manlio.perillo@gmail.com

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi.

What is the reason why PQsendPrepare function does not send a
Describe Portal message?

Just as a proof of concept, I wrote a very simple patch, attached, and
it *seems* to work.

Sending a Describe Portal message, make it possible for PQsendPrepare
function to *return* a PGresult with more useful informations, instead
of just the result status.

Thanks Manlio Perillo
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlEZT8IACgkQscQJ24LbaUT0VwCcCGKGD6CYrb53B/z+1SdB8vX5
cWkAnjOkSxCVFRo32qzIegY1UhddxBcI
=D+Qj
-----END PGP SIGNATURE-----

Attachments:

prepare-describe.patchtext/x-diff; name=prepare-describe.patchDownload+15-17
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Manlio Perillo (#1)
Re: send Describe Portal message in PQsendPrepare

Manlio Perillo <manlio.perillo@gmail.com> writes:

What is the reason why PQsendPrepare function does not send a
Describe Portal message?

That would add a round trip, no?

Sending a Describe Portal message, make it possible for PQsendPrepare
function to *return* a PGresult with more useful informations, instead
of just the result status.

That's *definitely* wrong, because the entire point of the PQsend
functions is they don't wait for a server response.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Manlio Perillo
manlio.perillo@gmail.com
In reply to: Tom Lane (#2)
Re: send Describe Portal message in PQsendPrepare

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Il 11/02/2013 22:39, Tom Lane ha scritto:

Manlio Perillo <manlio.perillo@gmail.com> writes:

What is the reason why PQsendPrepare function does not send a
Describe Portal message?

That would add a round trip, no?

Well, no.

An extra round trip is required with current implementation, since I
need to call PQsendPrepare, wait for server response, call
PQsendDescribePrepared, wait for server response.

Sending a Describe Portal message, make it possible for PQsendPrepare
function to *return* a PGresult with more useful informations, instead
of just the result status.

That's *definitely* wrong, because the entire point of the PQsend
functions is they don't wait for a server response.

The PQsendQueryParams sends the following protocol messages:

* Parse
* Bind
* Describe Portal
* Execute
* Sync

and of course does not wait for each response, since this is done in the
state machine.

I noted that PQsendQueryParams sends a Describe Portal message, and I
found it strange that the same is not done by PQsendPrepare.

I wrote the patch to check if this was done due to some technical
reason, but this seems to not be the case.

regards, tom lane

Regards Manlio Perillo
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlEaLvkACgkQscQJ24LbaUSBgACgjASGXyTl+rpHWGAGk5nm7Fnj
T68Anin9iEfbLw75ObHJxU6yfIazEZDS
=ZmPu
-----END PGP SIGNATURE-----

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers