On Mon, Nov 2, 2020 at 2:33 PM Heikki Linnakangas <hlinn...@iki.fi> wrote: > > While looking at the parallel copy patches, it started to annoy me how > large copy.c is. It confuses my little head. (Ok, it's annoyed me many > times in the past, but I haven't done anything about it.) >
+1 for having copy from & copy to functionality in separate files. This is present in both copyfrom.c & copyto.c, can it be removed from one place & moved to a common header file? static const char BinarySignature[11] = "PGCOPY\n\377\r\n\0"; CopyDest was changed to: typedef enum CopySource { COPY_FILE, /* from file (or a piped program) */ COPY_OLD_FE, /* from frontend (2.0 protocol) */ COPY_NEW_FE, /* from frontend (3.0 protocol) */ COPY_CALLBACK /* from callback function */ } CopySource; typedef enum CopyDest { COPY_FILE, /* to file (or a piped program) */ COPY_OLD_FE, /* to frontend (2.0 protocol) */ COPY_NEW_FE, /* to frontend (3.0 protocol) */ } CopyDest; Should we have one enum or both are required, if both are required we could think of naming like COPY_TO_FILE, COPY_FROM_FILE, it will make it more clearer. There is one warning while applying the v2 patch: Applying: Split copy.c into copyto.c and copyfrom.c. /home/vignesh/postgres/postgres/.git/rebase-apply/patch:909: trailing whitespace. warning: 1 line adds whitespace errors. There is one compilation error, may be this Assert is not required: copyto.c: In function ‘BeginCopyTo’: copyto.c:477:11: error: ‘is_from’ undeclared (first use in this function) Assert(!is_from); Regards, Vignesh EnterpriseDB: http://www.enterprisedb.com