On Mon, 28 Oct 2024 at 17:58, Heikki Linnakangas <hlinn...@iki.fi> wrote: > > - The Query message sends an LSN to wait for. (This doesn't handle the > > extended query protocol yet.) > > I'd suggest adding a new message type for this, so that it works the > same with simple and extended query. Or if you just want to wait without > issuing any query.
Big +1 to this. After thinking about it more, I think this would make a fancy pooler much easier to implement. Because then the pooler could simply send such a new WaitForLSN message whenever it wants to, e.g. before handing off the server connection to the client. Instead of having to intercept every Query/Execute message that the client is sending, and modify that in place before sending it on to the server. Writing the previous down made me realize that using a separate message would be nice for this usecase too. As opposed to including it in ReadyForQuery. Because if the fancy pooler wants to configure these LSNs transparently for a client that has not set the protocol parameter, it would need to strip the new LSN field from the ReadyForQuery message before forwarding it to the client. Stripping out a whole message is generally easier to do than modifying messages in place.