On 3/3/21 2:43 PM, Peter Eisentraut wrote:
I think, the way the abstractions are chosen in this patch, it is still very much tied to how the libpq protocol works. For example, there is a cancel key and a ready-for-query message. Some of the details of the simple and the extended query are exposed. So you could create a protocol that has a different way of encoding the payloads, as your telnet example does, but I don't believe that you could implement a competitor's protocol through this. Unless you have that done and want to show it?
Correct, a lot of what this patch does is to allow a developer of such protocol extension to just "extend" what the server side libpq does, by building a wrapper around the function they are interested in. That doesn't change the protocol, but rather allows additional functionality like the telemetry data gathering, Fabrizio was talking about.
The telnet_srv tutorial extension (which needs more documentation) is an example of how far one can go by replacing those funcitons, in that it actually implements a very different wire protocol. This one still fits into the regular libpq message flow.
Another possibility, and this is what is being used by the AWS team implementing the TDS protocol for Babelfish, is to completely replace the entire TCOP mainloop function PostgresMain(). That is of course a rather drastic move and requires a lot more coding on the extension side, but the whole thing was developed that way from the beginning and it is working. I don't have a definitive date when that code will be presented. Kuntal or Prateek may be able to fill in more details.
Regards, Jan -- Jan Wieck Principle Database Engineer Amazon Web Services