mirror of
https://github.com/postgres/postgres.git
synced 2026-10-23 13:29:09 +03:00
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
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user