Re: Add PortalDrop in exec_execute_message - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Add PortalDrop in exec_execute_message
Date
Msg-id 202106072107.d4i55hdscxqj@alvherre.pgsql
Whole thread Raw
In response to Re: Add PortalDrop in exec_execute_message  (Yura Sokolov <y.sokolov@postgrespro.ru>)
Responses Re: Add PortalDrop in exec_execute_message
Re: Add PortalDrop in exec_execute_message
Re: Add PortalDrop in exec_execute_message
List pgsql-hackers
On 2021-May-27, Yura Sokolov wrote:

> Alvaro Herrera писал 2021-05-26 23:59:

> > I don't think they should do that.  The portal remains open, and the
> > libpq interface does that.  The portal gets closed at end of transaction
> > without the need for any client message.  I think if the client wanted
> > to close the portal ahead of time, it would need a new libpq entry point
> > to send the message to do that.
> 
> - PQsendQuery issues Query message, and exec_simple_query closes its
>   portal.
> - people doesn't expect PQsendQueryParams to be different from
>   PQsendQuery aside of parameter sending. The fact that the portal
>   remains open is a significant, unexpected and undesired difference.
> - PQsendQueryGuts is used in PQsendQueryParams and PQsendQueryPrepared.
>   It is always sends empty portal name and always "send me all rows"
>   limit (zero). Both usages are certainly to just perform query and
>   certainly no one expects portal remains open.

Thinking about it some more, Yura's argument about PQsendQuery does make
sense -- since what we're doing is replacing the use of a 'Q' message
just because we can't use it when in pipeline mode, then it is
reasonable to think that the replacement ought to have the same
behavior.  Upon receipt of a 'Q' message, the portal is closed
automatically, and ISTM that that behavior should be preserved.

That change would not solve the problem he complains about, because IIUC
his framework is using PQsendQueryPrepared, which I'm not proposing to
change.  It just removes the other discrepancy that was discussed in the
thread.

The attached patch does it.  Any opinions?

-- 
Álvaro Herrera       Valdivia, Chile
"[PostgreSQL] is a great group; in my opinion it is THE best open source
development communities in existence anywhere."                (Lamar Owen)



pgsql-hackers by date:

Previous
From: "Joel Jacobson"
Date:
Subject: Re: security_definer_search_path GUC
Next
From: "David G. Johnston"
Date:
Subject: Re: security_definer_search_path GUC