Re: refactor the CopyOneRowTo

2024-08-16 Thread Heikki Linnakangas
On 31/07/2024 16:30, Junwang Zhao wrote: On Fri, Jul 5, 2024 at 12:26 AM jian he wrote: overall less "if else" logic, also copy format don't change during copy, we don't need to check binary or nor for each datum value. Committed, thanks. For the archives: this code is in a very hot path dur

Re: refactor the CopyOneRowTo

2024-07-31 Thread Junwang Zhao
On Fri, Jul 5, 2024 at 12:26 AM jian he wrote: > > original CopyOneRowTo: > https://git.postgresql.org/cgit/postgresql.git/tree/src/backend/commands/copyto.c#n922 > I change it to: > --- > if (!cstate->opts.binary) > { > foreach_int(attnum, cstate->attnumlist) > { > Datum value

Re: refactor the CopyOneRowTo

2024-07-31 Thread Ilia Evdokimov
Hi, hackers I'm sure this refactoring is useful because it's more readable when datum value is binary or not. However, I can see a little improvement. We can declare variable 'bytea *outputbytes' in 'else' because variable is used nowhere except this place. Regards, Ilia Evdokimov, Tanto

refactor the CopyOneRowTo

2024-07-04 Thread jian he
original CopyOneRowTo: https://git.postgresql.org/cgit/postgresql.git/tree/src/backend/commands/copyto.c#n922 I change it to: --- if (!cstate->opts.binary) { foreach_int(attnum, cstate->attnumlist) { Datum value = slot->tts_values[attnum - 1]; bool isnull = slot->tts_isnull[attn