>Hi Kyotaro-san,
>
>Thank you very much for the comments.
>
>I still think the unsupported-target check should happen first, because that 
>is the main problem. If a user spends time fixing a WHERE clause error, then 
>the command to fails again with “cannot copy to xxx”, the user may feel 
>frustrated.
>
>But I am convinced by your point about making this consistent with COPY TO. So 
>let’s use this patch to fix the “not waiting for input” problem first. I will 
>try to work on the unsupported-target-check ordering for v20, considering COPY 
>TO and COPY FROM together.
>
>PFA v2. The patch is much simpler now. It only moves the unsupported-target 
>check to BeginCopyFrom(), so the check happens before waiting for input.
>
>Best regards,
>--
>Chao Li (Evan)
>HighGo Software Co., Ltd.
>https://www.highgo.com/


Hi, everyone

Thanks a lot for the patch and detailed comments.

In most scenarios, after constructing the `CopyFromState` within 
`BeginCopyFrom()`,
we immediately pass it into `CopyFrom()` and invoke the function. By moving the 
relevant
validation checks from `CopyFrom()` into `BeginCopyFrom()`, we can deliver 
error feedback much earlier.

This way, validation will be performed in advance before waiting for input 
sources
({ 'filename' | PROGRAM 'command' | STDIN }) to be ready, so that errors can be
reported to the client side in a timelier manner.

Besides, `file_fdw.c` also stores the return value of `BeginCopyFrom()` inside 
its callback parameters,
so it will equally benefit from this earlier validation.

This patch looks good to me.


regards,
--
ZizhuanLiu (X-MAN) 
[email protected]










Reply via email to