Re: Add PortalDrop in exec_execute_message

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Yura Sokolov <y(dot)sokolov(at)postgrespro(dot)ru>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Add PortalDrop in exec_execute_message
Date: 2021-06-07 21:07:34
Message-ID: 202106072107.d4i55hdscxqj@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2021-06-07 21:09:18 Re: security_definer_search_path GUC
Previous Message Joel Jacobson 2021-06-07 20:54:34 Re: security_definer_search_path GUC