Re: [Proposal] add portaddr like hostaddr

From: Denis Smirnov <darthunix(at)gmail(dot)com>
To: Diego <mrstephenamell(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [Proposal] add portaddr like hostaddr
Date: 2026-08-27 03:49:42
Message-ID: 71685CE0-477D-4E4B-ADFE-D3CC3873512C@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Diego,

I agree that this is a client-side issue and that libpq is a client
library. But that does not mean libpq should model the whole route to
the server.

A route can contain several SSH hops, proxies, and poolers:

libpq -> localhost:39907 -> SSH jump1 -> SSH jump2
-> PgBouncer:6432 -> PostgreSQL:5432

It is not clear why libpq should expose exactly two endpoints. Which
port is the "server port" here: 39907, 6432, or 5432? Only 39907 is
visible to libpq.

I think libpq should keep one connection endpoint, as it does today.
port and PQport() should continue to mean the port to which libpq
actually connects.

SSH forwarding should be configured by SSH itself, for example with
ProxyJump and LocalForward in ~/.ssh/config. If an application creates
a tunnel, it should manage that mapping itself. Pooler routing should
likewise remain in the pooler configuration.

For these reasons, I do not think portaddr belongs in libpq.

Best regards,
Denis Smirnov

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hayato Kuroda (Fujitsu) 2026-08-27 04:13:46 RE: Logical replication row filter loses unchanged toasted columns
Previous Message Zhijie Hou (Fujitsu) 2026-08-27 03:42:19 RE: tablecmds: fix bug where index rebuild loses replica identity on partitions