Re: PostgreSQL source code: copy command

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Adam Dziedzic <adam(dot)dziedzi(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: PostgreSQL source code: copy command
Date: 2015-09-11 18:12:22
Message-ID: 7409.1441995142@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Adam Dziedzic <adam(dot)dziedzi(at)gmail(dot)com> writes:
> in file: /src/backend/command/copy.c
> I found that it can happen that there is nothing in the buffer
> (fe_msgbuf) to be written to a file and there is only a check of count
> (which in this case would be 0):

> 498 if (fwrite(fe_msgbuf->data, fe_msgbuf->len, 1,
> 499 cstate->copy_file) != 1 ||
> 500 ferror(cstate->copy_file))

On what grounds do you claim that control can reach there without any
data in the buffer? AFAICS, there must be at least either a row header
(if binary mode) or trailer (if not).

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Bastiaan Olij 2015-09-17 03:21:46 Combining insert rules on views with functions
Previous Message Adam Dziedzic 2015-09-11 17:46:24 PostgreSQL source code: copy command