> On May 9, 2026, at 23:35, Álvaro Herrera <[email protected]> wrote: > > Hello, > > On 2026-May-09, Chao Li wrote: > >> I found this issue while reviewing the patch [1] and was suggested use >> a separate thread for the issue. >> >> In tablesync.c, copy_table() currently does: >> ``` >> copybuf = makeStringInfo(); >> ``` >> >> But copybuf is only used by copy_read_data(), and there it's really >> just acting as a small state holder for data, len, and cursor, rather >> than as a normal growable StringInfo. > > I find this coding pattern weird and ugly and confusing. If what we > need is three variables, shouldn't we have three variables instead of > this strange misuse of the StringInfo abstraction? >
Yep, I first considered adding a file-local structure, but decided to keep the changes minimal in the first version. In v2, I switched to using a small file-local CopyBuf structure. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/
v2-0001-Use-simple-struct-for-table-sync-COPY-buffer-stat.patch
Description: Binary data
