On Thu, Mar 4, 2021 at 5:13 AM Heikki Linnakangas <hlinn...@iki.fi> wrote: > > I posted this earlier at > https://www.postgresql.org/message-id/9ec25819-0a8a-d51a-17dc-4150bb3cc...@iki.fi , > and that led to removing FE/BE protocol version 2 support. That's been > committed now, so here's COPY FROM patch again, rebased.
Looks good to me. Just a couple minor things: + * Look at the next character. If we're at EOF, c2 will wind + * up as '\0' because of the guaranteed pad of raw_buf. */ - IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(0); - - /* get next char */ c = copy_raw_buf[raw_buf_ptr]; The new comment seems copy-pasted from the c2 statements further down. - if (raw_buf_ptr >= copy_buf_len || need_data) +#define COPY_READ_LINE_LOOKAHEAD 4 + if (raw_buf_ptr + COPY_READ_LINE_LOOKAHEAD >= copy_buf_len) Is this #define deliberately put down here rather than at the top of the file? - * of the buffer and then we load more data after that. This case occurs only - * when a multibyte character crosses a bufferload boundary. + * of the buffer and then we load more data after that. Is the removed comment really invalidated by this patch? I figured it was something not affected until the patch to do the encoding conversion in larger chunks. -- John Naylor EDB: http://www.enterprisedb.com