Re: Validate SERVER subscription conninfo during ALTER SUBSCRIPTION ... OWNER TO

Поиск
Список
Период
Сортировка
Искать

Re: Validate SERVER subscription conninfo during ALTER SUBSCRIPTION ... OWNER TO

От:
yuanchao zhang <145zhangyc@gmail.com>
Дата:


On Tue, Jul 21, 2026 at 3:23 PM Fujii Masao <masao.fujii@gmail.com> wrote:
Hi,

While tryng the new v19 feature CREATE/ALTER SUBSCRIPTION ... SERVER,
I found that ALTER SUBSCRIPTION ... OWNER TO can change the effective
conninfo for a SERVER subscription, but does not validate the new owner's
generated conninfo with walrcv_check_conninfo().

As a result, the owner of a SERVER subscription with password_required=true
can be changed to a non-superuser whose generated connection string does not
contain a password. The ownership change succeeds, but the subscription is
left in a state that will fail later when a worker or another command tries to
connect.

Isn't this problematic?

The attached patch fixes this by making ALTER SUBSCRIPTION ... OWNER TO
validate the new owner's generated conninfo with walrcv_check_conninfo().
It also updates the ALTER SUBSCRIPTION documentation to mention
the SERVER-specific requirements for changing the owner.

Thought?

Regards,

--
Fujii Masao
 
Sounds correct to me to do the conninfo validation.

A small comment on the documentation change:

+   for the new owner or for <literal>PUBLIC</literal> must exist, and the
+   connection string generated for the new owner must satisfy the subscription's
+   <literal>password_required</literal> setting.

From the implementation, only when a new owner is not superuser, it needs to satisfy the password_required setting.

Regards,
Yuanchao Zhang

RE: Validate SERVER subscription conninfo during ALTER SUBSCRIPTION ... OWNER TO

От:
"Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Дата:
Dear Fujii-san,

> While tryng the new v19 feature CREATE/ALTER SUBSCRIPTION ... SERVER,
> I found that ALTER SUBSCRIPTION ... OWNER TO can change the effective
> conninfo for a SERVER subscription, but does not validate the new owner's
> generated conninfo with walrcv_check_conninfo().
> As a result, the owner of a SERVER subscription with password_required=true
> can be changed to a non-superuser whose generated connection string does not
> contain a password.

Not sure, but can we also meet the similar situation via ALTER USER MAPPING
... (DROP password) command? I.e., the command would succeed but the worker
will fail.
If so, should we also fix the case? Or it's something like "Don't do that" situation?

Best regards,
Hayato Kuroda
FUJITSU LIMITED

pgsql: postgres_fdw: Disable attribute statistics import from pre-9.1 s

От:
Etsuro Fujita <efujita@postgresql.org>
Дата:
Вложения:
postgres_fdw: Disable attribute statistics import from pre-9.1 servers.

To import attribute statistics, postgres_fdw sent a query wity COLLATE
"C" to remote servers without checking their version.  Since COLLATE is
only supported since v9.1, this could break the import against older
servers; fix by modifying postgres_fdw to check their version and if
older, fall back to sampling.  (This commit still allows importing only
relation statistics from such an older server.)

Also, expand the documentation to mention that attribute statistics are
stored into the local server without applying the foreign table columns'
n_distinct option.

Oversight in commit 28972b6fc.

Reported-by: Fujii Masao 
Reported-by: Osama Abdul Qader 
Author: Etsuro Fujita 
Reviewed-by: Corey Huinker 
Discussion: https://postgr.es/m/CAHGQGwH8%2BuDTwfohpck9v_9L3nwSWACbmC36JYRyqHd5xQN_OA%40mail.gmail.com
Backpatch-through: 19

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3ca4abd60ce3661c6ccd3d83a13986ef9541bf40

Modified Files
--------------
contrib/postgres_fdw/postgres_fdw.c | 35 +++++++++++++++++++++++------------
doc/src/sgml/postgres-fdw.sgml      | 11 ++++++-----
2 files changed, 29 insertions(+), 17 deletions(-)

FAQ