Manu <[email protected]> wrote:

> The dummy command works: with v06-0001 alone, case 2 keeps the
> COPY's row. But with 0002 applied as well it is still lost, the
> same as on v05 and master. Tested on master 9ebc9a458c3.
> 
> > v06 fixes this too (hopefully it doesn't break the previous fixes).
> 
> The script from my last mail gives 1, 1 and 1 rows in
> pg_stat_progress_copy with v06-0001 alone, but 1, 0 and 0 with
> 0001 and 0002, as before.
> 
> With two file_fdw scans in the trigger's query,
> fileBeginForeignScan() turns pgstat_track_progress off, so neither
> inner COPY is pushed.  But fileEndForeignScan() turns it back on
> before EndCopyFrom(), so the first inner COPY's
> pgstat_progress_end_command() runs, finds no parent and ends the
> outer COPY.  Resuming after EndCopyFrom() would avoid that,

I've fixed it this way, thanks.

> but since 0001 now keeps the outer row by itself here, maybe 0002 can rely
> on the dummy command too.

Disabling the reporting in file_fdw (if the number of nodes is greater than
one) seems cleaner. If file_fdw relied on the fact that the 2nd node will be
treated as dummy, the 1st one would still appear in the pg_stat_progress_copy
view, and it wouldn't receive updates.

-- 
Antonin Houska
Web: https://www.cybertec-postgresql.com

Attachment: v07-0001-Allow-progress-tracking-of-sub-commands.patch
Description: application/mbox

Attachment: v07-0002-Do-not-report-progress-of-two-or-more-COPY-commands-.patch
Description: application/mbox

Reply via email to