Re: Add PortalDrop in exec_execute_message
Alvaro Herrera <alvherre@alvh.no-ip.org>
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Yura Sokolov <y.sokolov@postgrespro.ru>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, pgsql-hackers@lists.postgresql.org
Date: 2021-05-26T20:59:17Z
Lists: pgsql-hackers
On 2021-May-25, Yura Sokolov wrote: > Tom Lane писал 2021-05-21 21:23: > > Yura Sokolov <y.sokolov@postgrespro.ru> writes: > > > I propose to add PortalDrop at the 'if (completed)' branch of > > > exec_execute_message. > > > > This violates our wire protocol specification, which > > specifically says > > > > If successfully created, a named portal object lasts till the end of > > the current transaction, unless explicitly destroyed. An unnamed > > portal is destroyed at the end of the transaction, or as soon as the > > next Bind statement specifying the unnamed portal as destination is > > issued. (Note that a simple Query message also destroys the unnamed > > portal.) > > > > I'm inclined to think that your complaint would be better handled > > by having the client send a portal-close command, if it's not > > going to do something else immediately. > > I thought about it as well. Then, if I understand correctly, > PQsendQueryGuts and PQsendQueryInternal in pipeline mode should send > "close portal" (CP) message after "execute" message, right? 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. (I didn't add a Close Portal message to PQsendQueryInternal in pipeline mode precisely because there is no such message in PQsendQueryGuts. I think it would be wrong to unconditionally add a Close Portal message to any of those places.) -- Álvaro Herrera 39°49'30"S 73°17'W
Commits
-
Add 'Portal Close' message to pipelined PQsendQuery()
- 4efcf47053ea 14.0 landed
-
Shut down EvalPlanQual machinery when LockRows node reaches the end.
- bb4aed46a5ae 14.0 landed
-
Update libpq to make new features of FE/BE protocol available to
- efc3a25bb02a 7.4.1 cited
-
Extended query protocol: parse, bind, execute, describe FE/BE messages.
- 16503e6fa4a1 7.4.1 cited