Re: Extensibility of the PostgreSQL wire protocol

Jan Wieck <jan@wi3ck.info>

From: Jan Wieck <jan@wi3ck.info>
To: Kuntal Ghosh <kuntalghosh.2007@gmail.com>
Cc: Dave Cramer <davecramer@postgres.rocks>, Robert Haas <robertmhaas@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, "Jonah H. Harris" <jonah.harris@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-02-22T15:01:41Z
Lists: pgsql-hackers

Attachments

On 2/19/21 4:36 AM, Kuntal Ghosh wrote:
> On Thu, Feb 18, 2021 at 9:32 PM Jan Wieck <jan@wi3ck.info> wrote:

> Few comments in the extension code (although experimental):
> 
> 1. In telnet_srv.c,
> + static int        pe_port;
> ..
> +       DefineCustomIntVariable("telnet_srv.port",
> +                                                       "Telnet server port.",
> +                                                       NULL,
> +                                                       &pe_port,
> +                                                       pe_port,
> +                                                       1024,
> +                                                       65536,
> +                                                       PGC_POSTMASTER,
> +                                                       0,
> +                                                       NULL,
> +                                                       NULL,
> +                                                       NULL);
> 
> The variable pe_port should be initialized to a value which is > 1024
> and < 65536. Otherwise, the following assert will fail,
> TRAP: FailedAssertion("newval >= conf->min", File: "guc.c", Line:
> 5541, PID: 12100)
> 
> 2. The function pq_putbytes shouldn't be used by anyone other than
> old-style COPY out.
> +       pq_putbytes(msg, strlen(msg));
> Otherwise, the following assert will fail in the same function:
>      /* Should only be called by old-style COPY OUT */
>      Assert(DoingCopyOut);
> 

Attached are an updated patch and telnet_srv addressing the above problems.


Regards, Jan

-- 
Jan Wieck
Principle Database Engineer
Amazon Web Services