From: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
---|---|
To: | Stephen Frost <sfrost(at)snowman(dot)net> |
Cc: | PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: postgres_fdw IMPORT SCHEMA and partitioned tables |
Date: | 2017-03-10 01:26:22 |
Message-ID: | CAB7nPqSjyMBDDk+RHRoPVZ7yWZTvq73_Bg0HTG9hR0T=O1f5mg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Mar 9, 2017 at 11:15 PM, Stephen Frost <sfrost(at)snowman(dot)net> wrote:
> While reviewing Amit Langote's patch to handle partitioned tables
> properly in various contrib modules (mostly by throwing an error since
> things like pageinspect aren't going to work on the empty 'parent'
> table), I went looking through contrib for other modules that do
> something with relkind and noticed that postgres_fdw's IMPORT SCHEMA
> would pull in the child tables (relkind = 'r') but would ignore the
> parent table (relkind = 'P', or soon to be 'p', I guess).
It is not as straight-forward as it seems. A foreign table can be
defined as a child (use of PARTITION OF), but not as a parent (use
PARTITION BY), and IMPORT SCHEMA has to issue queries to create
foreign tables. It seems to me that the correct fix here is to ignore
child tables that are part of a partition, and just include the parent
in what is imported so as when querying the parent through
postgres_fdw all the child partitions are considered automatically.
Thoughts?
Of course this should be documented.
> I tend to view this as an issue which should be added to the open items
> list and resolved before PG10 (though perhaps it could be done after
> feature freeze), but I could see an argument that it should be just a
> documented limitation of postgres_fdw and that adding such support would
> be a new feature.
Agreed. I think that this is a bug, because any database having one
partitioning set of tables would fail to import automatically except
by excluding some tables, and that's annoying for the user.
> In any case, this seems like an issue that should be addressed one way
> or the other, so I'll add it to the open items list. I'm not planning
> to work on fixing it myself, but if someone proposes a patch which looks
> reasonable, I'll try to find time for it.
Well, I worked on IMPORT SCHEMA, so I'm fine to do something. After
the CF is done though.
--
Michael
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2017-03-10 01:29:39 | Re: [PATCH] Enabling atomics on ARM64 |
Previous Message | Amit Langote | 2017-03-10 01:23:16 | Re: Documentation improvements for partitioning |