Re: Extensibility of the PostgreSQL wire protocol

From: Kuntal Ghosh <kuntalghosh(dot)2007(at)gmail(dot)com>
To: Jan Wieck <jan(at)wi3ck(dot)info>
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-02-19 09:36:41
Message-ID: CAGz5QCLT3M=9HMsOyHagxygjbf3P0zS8=Shk4g_QwjGjZai1Bw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Feb 18, 2021 at 9:32 PM Jan Wieck <jan(at)wi3ck(dot)info> wrote:
>
And, here is how it looks with the following configuration:
telnet_srv.port = 1433
telnet_srv.listen_addresses = '*'

telnet localhost 1433

  master
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
PostgreSQL Telnet Interface

database name: postgres
username: kuntal
password: changeme
> select 1;
?column?
----
1

SELECT 1
> select 1/0;
Message: ERROR - division by zero

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);

--
Thanks & Regards,
Kuntal Ghosh
Amazon Web Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andy Fan 2021-02-19 10:03:10 Re: Extend more usecase for planning time partition pruning and init partition pruning.
Previous Message Dent John 2021-02-19 09:25:44 Re: [WIP] UNNEST(REFCURSOR): allowing SELECT to consume data from a REFCURSOR