Re: postgres_fdw: IMPORT FOREIGN SCHEMA ... LIMIT TO (partition)

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: Amit Langote <amitlangote09(at)gmail(dot)com>
Cc: Bernd Helmle <mailings(at)oopsware(dot)de>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Stephen Frost <sfrost(at)snowman(dot)net>, Michael Paquier <michael(at)paquier(dot)xyz>
Subject: Re: postgres_fdw: IMPORT FOREIGN SCHEMA ... LIMIT TO (partition)
Date: 2021-04-06 12:29:20
Message-ID: ac9d722d-dd6c-4dc9-30f9-dee54e162601@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2021/04/06 16:05, Amit Langote wrote:
> On Tue, Apr 6, 2021 at 8:34 AM Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com> wrote:
>> For now I have no objection to this feature.
>>
>> -IMPORT FOREIGN SCHEMA import_source EXCEPT (t1, "x 4", nonesuch)
>> +IMPORT FOREIGN SCHEMA import_source EXCEPT (t1, "x 4", nonesuch, t4_part)
>>
>> Isn't it better to create also another partition like "t4_part2"?
>> If we do this, for example, the above test can confirm that both
>> partitions in EXCEPT and not in are excluded.
>>
>> + All tables or foreign tables which are partitions of some other table
>> + are automatically excluded from <xref linkend="sql-importforeignschema"/>
>> + unless they are explicitly included in the <literal>LIMIT TO</literal>
>>
>> IMO it's better to document that partitions are imported when they are
>> included in LIMIT TO, instead. What about the following?
>>
>> Tables or foreign tables which are partitions of some other table are
>> imported only when they are explicitly specified in
>> <literal>LIMIT TO</literal> clause. Otherwise they are automatically
>> excluded from <xref linkend="sql-importforeignschema"/>.
>>
>> + clause. Since all data can be accessed through the partitioned table
>> + which is the root of the partitioning hierarchy, this approach should
>> + allow access to all the data without creating extra objects.
>>
>> Now "this approach" in the above is not clear? What about replacing it with
>> something like "importing only partitioned tables"?
>
> +1, that wording is better.

Thanks! So I applied all the changes that I suggested upthread to the patch.
I also updated the comment as follows.

* Import table data for partitions only when they are explicitly
- * specified in LIMIT TO clause. Otherwise ignore them and
- * only include the definitions of the root partitioned tables to
- * allow access to the complete remote data set locally in
- * the schema imported.
+ * specified in LIMIT TO clause. Otherwise ignore them and only
+ * include the definitions of the root partitioned tables to allow
+ * access to the complete remote data set locally in the schema
+ * imported.

Attached is the updated version of the patch. Barring any objection,
I'm thinking to commit this.

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

Attachment Content-Type Size
v2-0001-Update-postgres_fdw-to-import-partitions-when-nam.patch text/plain 7.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Drouvot, Bertrand 2021-04-06 12:30:29 Re: Minimal logical decoding on standbys
Previous Message Michael Paquier 2021-04-06 12:19:52 Re: Reference Leak with type