From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: OOM in libpq and infinite loop with getCopyStart() |
Date: | 2016-03-22 05:19:29 |
Message-ID: | CAA4eK1JD_pwAamMNcb3+VbgVQZQFKdfvcSoGCMwcsbebXint+g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Mar 22, 2016 at 9:46 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> writes:
> > On Mon, Mar 21, 2016 at 10:13 PM, Robert Haas <robertmhaas(at)gmail(dot)com>
wrote:
> >> It is very difficult to believe that this is a good idea:
> >>
> >> --- a/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
> >> +++ b/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
> >> @@ -445,6 +445,7 @@ libpqrcv_PQexec(const char *query)
> >> if (PQresultStatus(lastResult) == PGRES_COPY_IN ||
> >> PQresultStatus(lastResult) == PGRES_COPY_OUT ||
> >> PQresultStatus(lastResult) == PGRES_COPY_BOTH ||
> >> + PQresultStatus(lastResult) == PGRES_FATAL_ERROR ||
> >> PQstatus(streamConn) == CONNECTION_BAD)
> >> break;
> >>
> >> I mean, why would it be a good idea to blindly skip over fatal errors?
>
> > I think it is not about skipping the FATAL error, rather to stop trying
to
> > get further results on FATAL error.
>
> If the code already includes "lost the connection" as a case to break on,
> I'm not quite sure why "got a query error" is not.
>
This error check is exactly same as PQexecFinish() and there some
explanation is given in comments which hints towards the reason for
continuing on error, basically both the functions PQexecFinish()
and libpqrcv_PQexec() returns the last result if there are many
and PQexecFinish() concatenates the errors as well in some cases. Do we
see any use in continuing to get result after getting PGRES_FATAL_ERROR
error?
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Stehule | 2016-03-22 05:20:01 | Re: Relax requirement for INTO with SELECT in pl/pgsql |
Previous Message | Peter Geoghegan | 2016-03-22 05:16:34 | Re: Missing rows with index scan when collation is not "C" (PostgreSQL 9.5) |