diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c index cfe649a6d8d..46b2021bf64 100644 --- a/contrib/postgres_fdw/postgres_fdw.c +++ b/contrib/postgres_fdw/postgres_fdw.c @@ -5867,17 +5867,18 @@ 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, if the remote table is (or was once) inherited, fallback to + * sampling. + * + * XXX FIXME: for the case where it's inherited, we could 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 79e79aa6ce2..d7d83a7f570 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. + + + Note that this option doesn't currently handle the case where the + remote table is (or was once) inherited. This is an implementition + restriction that might be fixed in a future release. +