agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Etsuro Fujita <efujita@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: postgres_fdw: Disable attribute statistics import from pre-9.1 s
Date: Mon, 14 Sep 2026 10:04:07 +0000
Message-ID: <E1x63Xj-00000000GjS-1ERG@gemulon.postgresql.org> (raw)

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 <masao.fujii@gmail.com>
Reported-by: Osama Abdul Qader <osamaabdulqader.cs@gmail.com>
Author: Etsuro Fujita <etsuro.fujita@gmail.com>
Reviewed-by: Corey Huinker <corey.huinker@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwH8%2BuDTwfohpck9v_9L3nwSWACbmC36JYRyqHd5xQN_OA%40mail.gmail.com
Backpatch-through: 19

Branch
------
REL_19_STABLE

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

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



view thread (2+ messages)

Message-ID: <E1x63Xj-00000000GjS-1ERG@gemulon.postgresql.org>
Permalink:  ../E1x63Xj-00000000GjS-1ERG@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1x63Xj-00000000GjS-1ERG@gemulon.postgresql.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: efujita@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: postgres_fdw: Disable attribute statistics import from pre-9.1 s
  In-Reply-To: <E1x63Xj-00000000GjS-1ERG@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox