Re: [POC] Fast COPY FROM command for the table with foreign partitions - Mailing list pgsql-hackers

From Zhihong Yu
Subject Re: [POC] Fast COPY FROM command for the table with foreign partitions
Date
Msg-id CALNJ-vSvDfpuoZfOgkP+=6eAwn6VPFAARhPT_aW6HAhK63NC9Q@mail.gmail.com
Whole thread Raw
In response to Re: [POC] Fast COPY FROM command for the table with foreign partitions  (Andrey Lepikhov <a.lepikhov@postgrespro.ru>)
List pgsql-hackers


On Thu, Apr 8, 2021 at 5:49 PM Justin Pryzby <pryzby@telsasoft.com> wrote:
I rebased this patch to resolve a trivial 1 line conflict from c5b7ba4e6.

--
Justin

Hi,
In src/backend/commands/copyfrom.c :

+   if (resultRelInfo->ri_RelationDesc->rd_rel->relkind == RELKIND_FOREIGN_TABLE)

There are a few steps of indirection. Adding assertion before the if statement on resultRelInfo->ri_RelationDesc, etc would help catch potential invalid pointer.

+CopyToStart(CopyToState cstate)
...
+CopyToFinish(CopyToState cstate)

Since 'copy to' is the action, it would be easier to read the method names if they're called StartCopyTo, FinishCopyTo, respectively.
That way, the method names would be consistent with existing ones, such as:
 extern uint64 DoCopyTo(CopyToState cstate);

+    * If a partition's root parent isn't allowed to use it, neither is the

In the above sentence, 'it' refers to multi insert. It would be more readable to explicitly mention 'multi insert' instead of 'it'

Cheers

pgsql-hackers by date:

Previous
From: Peter Smith
Date:
Subject: Re: [HACKERS] logical decoding of two-phase transactions
Next
From: Bharath Rupireddy
Date:
Subject: Re: TRUNCATE on foreign table