On Fri, Feb 5, 2021 at 11:01 PM Fujii Masao <masao.fu...@oss.nttdata.com> wrote: > > > > On 2021/02/05 16:52, Kasahara Tatsuhito wrote: > > Hi, > > > > The following is written in the comments of PQputCopyEnd(). > > > > (snip) > > * Returns 1 if successful, 0 if data could not be sent (only possible > > * in nonblock mode), or -1 if an error occurs. > > (snip) > > > > The PQputCopyEnd() section of the manual (libpq.sgml) describes the > > following. > > > > The result is 1 if the termination message was sent; or in > > nonblocking mode, this may only indicate that the termination > > message was successfully queued. (In nonblocking mode, to be > > certain that the data has been sent, you should next wait for > > write-ready and call <xref linkend="libpq-PQflush"/>, repeating > > until it > > returns zero.) Zero indicates that the function could not queue > > the termination message because of full buffers; this will only > > happen in nonblocking mode. (In this case, wait for > > write-ready and try the <xref linkend="libpq-PQputCopyEnd"/> call > > again.) If a hard error occurs, -1 is returned; you can use > > <xref linkend="libpq-PQerrorMessage"/> to retrieve details. > > > > > > These says that 0 may be returned if a non-blocking mode is used, but > > there doesn't seem to be any case where 0 is returned in the code of > > PQputCopyEnd(). > > I found the past discussion [1] about this issue. > > [1] > https://www.postgresql.org/message-id/CA+Tgmobjj+0modbnmjy7ezeBFOBo9d2mAVcSPkzLx4LtZmc==g...@mail.gmail.com Oh, thank you. I understood what was unclear.
Best regards, > > Regards, > > -- > Fujii Masao > Advanced Computing Technology Center > Research and Development Headquarters > NTT DATA CORPORATION -- Tatsuhito Kasahara kasahara.tatsuhito _at_ gmail.com