postgres.git / summary / log / commit / refs
commit 683ce2329c2d5fb2f7bf625131cd5d9de15987a8
Author: Etsuro Fujita <efujita@postgresql.org>
Date: Thu Sep 10 08:30:01 2026 +0000
postgres_fdw: Adjust warning message in statistics import.
The previous warning message when falling back to sampling in a certain
case failed to properly mention the reason for that.
Also, for clarity, rewrite a comment about the fallback and add a note
about it to postgres-fdw.sgml.
Follow-up to commit 6a8571568.
Reported-by: Fujii Masao <masao.fujii@gmail.com>
Author: Etsuro Fujita <etsuro.fujita@gmail.com>
Reviewed-by: Corey Huinker <corey.huinker@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwHq1VuXwxeDU8N4dd9U4RFEW982qQ9C26mRQDs3nu_Naw%40mail.gmail.com
Backpatch-through: 19
contrib/postgres_fdw/postgres_fdw.c | 10 +++++-----
doc/src/sgml/postgres-fdw.sgml | 6 ++++++
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c
index d8f061e7c69..3f0b5bbe9ed 100644
--- a/contrib/postgres_fdw/postgres_fdw.c
+++ b/contrib/postgres_fdw/postgres_fdw.c
@@ -5637,17 +5637,17 @@ fetch_remote_statistics(Relation relation,
}
/*
- * If the remote table is inherited, relpages/reltuples in pg_class for it
- * provide stats for the parent table, not for the inheritance set. We
- * could calculate stats for the set by fetching the relation stats for
- * child tables as well; but for now, just fallback to sampling.
+ * For now, we don't support the case where the remote table is (or was
+ * once) inherited; fallback to sampling in that case. XXX FIXME: for the
+ * case where it is inherited, we could also support it by fetching and
+ * adding the relation stats for child tables as well.
*/
if ((relkind == RELKIND_RELATION || relkind == RELKIND_FOREIGN_TABLE) &&
strcmp(PQgetvalue(relstats, 0, RELSTATS_RELHASSUBCLASS), "t") == 0)
{
ereport(WARNING,
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("could not import statistics for foreign table \"%s.%s\" --- remote table \"%s.%s\" is inherited",
+ errmsg("could not import statistics for foreign table \"%s.%s\" --- remote table \"%s.%s\" is (or was once) inherited",
local_schemaname, local_relname,
remote_schemaname, remote_relname));
goto fetch_cleanup;
diff --git a/doc/src/sgml/postgres-fdw.sgml b/doc/src/sgml/postgres-fdw.sgml
index 01157f475fd..02c2edb2c97 100644
--- a/doc/src/sgml/postgres-fdw.sgml
+++ b/doc/src/sgml/postgres-fdw.sgml
@@ -389,6 +389,12 @@ OPTIONS (ADD password_required 'false');
table would have attempted to fetch and import the remote statistics
first if this option was enabled.
</para>
+
+ <para>
+ Note that this option doesn't currently support the case where the
+ remote table is (or was once) inherited. This is an implementation
+ restriction that might be fixed in a future release.
+ </para>
</listitem>
</varlistentry>
[parent: ca3fd678f47b]