Re: There doesn't seem to be any case where PQputCopyEnd() returns 0

From: Kasahara Tatsuhito <kasahara(dot)tatsuhito(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: There doesn't seem to be any case where PQputCopyEnd() returns 0
Date: 2021-02-07 02:02:21
Message-ID: CAP0=ZVLnSL-Tehh0w1HV3cPoE1xaLeJ=FU4TyK0jOhzHfY41_Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Feb 5, 2021 at 11:01 PM Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2021-02-07 03:38:39 Re: Single transaction in the tablesync worker?
Previous Message Michael Paquier 2021-02-07 00:39:36 Re: Preserve attstattarget on REINDEX CONCURRENTLY