| From: | Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com> |
|---|---|
| To: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com> |
| Cc: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com> |
| Subject: | Re: Further cleanup related to statistics import support in postgres_fdw |
| Date: | 2026-09-04 14:25:26 |
| Message-ID: | CAPmGK155DG3atVO--6ezTDyfbfXLkfsad6YHyomNnJEOXgzzaQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Fri, Sep 4, 2026 at 8:34 PM Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
> After the patch was committed, I observed that stats import could fail with
> the following warning even though the remote table is no longer
> inherited. Is this behavior intentional?
>
> WARNING: could not import statistics for foreign table
> "public.ft" --- remote table "public.t" is inherited
>
> Here is the procedure to reproduce this situation. The point is that
> the inheritance table is created and then dropped:
>
> --------------------------------
> CREATE TABLE t AS SELECT i FROM generate_series(1, 100) i;
> ANALYZE t;
> CREATE TABLE tt () INHERITS (t);
> DROP TABLE tt;
>
> CREATE EXTENSION postgres_fdw;
> CREATE SERVER loopback FOREIGN DATA WRAPPER postgres_fdw;
> CREATE USER MAPPING FOR public SERVER loopback;
> CREATE FOREIGN TABLE ft (i int) SERVER loopback OPTIONS (table_name
> 't', import_stats 'true');
>
> ANALYZE VERBOSE ft;
> WARNING: could not import statistics for foreign table "public.ft"
> --- remote table "public.t" is inherited
> --------------------------------
This is expected behavior, because postgres_fdw determines whether the
remote table is inherited or not, by checking only the table's
relhassubclass. We could check pg_inherits as well, to detect false
positives like this, but I didn't do so, because I don't think that
that is worth complicating the code, as table inheritance is not that
popular these days in the first place. Should we? I think another
option would be to add a note about this behavior.
Thanks for testing this!
Best regards,
Etsuro Fujita
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Dmitry Dolgov | 2026-09-04 14:35:16 | Re: Add ssl_(supported|shared)_groups to sslinfo |
| Previous Message | Tom Lane | 2026-09-04 14:21:52 | Re: CREATE SCHEMA ... CREATE DOMAIN support |