Re: Extensibility of the PostgreSQL wire protocol

From: Jan Wieck <jan(at)wi3ck(dot)info>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Kuntal Ghosh <kuntalghosh(dot)2007(at)gmail(dot)com>
Cc: Dave Cramer <davecramer(at)postgres(dot)rocks>, Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Jonah H(dot) Harris" <jonah(dot)harris(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Extensibility of the PostgreSQL wire protocol
Date: 2021-03-04 20:55:29
Message-ID: ca0a057d-674c-38db-b09c-eba5d75d8d57@wi3ck.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2021-03-04 20:55:54 Re: Removing support for COPY FROM STDIN in protocol version 2
Previous Message Alvaro Herrera 2021-03-04 20:51:50 Re: [HACKERS] PATCH: Batch/pipelining support for libpq