PostgreSQL source code: copy command

From: Adam Dziedzic <adam(dot)dziedzi(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: PostgreSQL source code: copy command
Date: 2015-09-11 17:46:24
Message-ID: 55F31370.2010109@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hello,

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))
501

Maybe, before the fwrite we should check if fe_msgbuf->len >
0.<http://doxygen.postgresql.org/structStringInfoData.html#ac3a8cfc741804836ba06d3619dc1c5be>

<http://doxygen.postgresql.org/structStringInfoData.html#ac3a8cfc741804836ba06d3619dc1c5be>
--
With kind regards,
Adam Dziedzic

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2015-09-11 18:12:22 Re: PostgreSQL source code: copy command
Previous Message James Keener 2015-09-10 14:30:45 Re: PostgreSQL, JDBC and BObj