Re: [PATCH] Fix division by zero (explain.c) - Mailing list pgsql-hackers

From James Coleman
Subject Re: [PATCH] Fix division by zero (explain.c)
Date
Msg-id CAAaqYe-45WH4Shfxb-xtwEq=dVa-Tycwif+bpDK_cuu6O-ZM2Q@mail.gmail.com
Whole thread Raw
In response to [PATCH] Fix division by zero (explain.c)  (Ranier Vilela <ranier.vf@gmail.com>)
Responses Re: [PATCH] Fix division by zero (explain.c)  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
List pgsql-hackers
On Thu, Apr 23, 2020 at 8:38 AM Ranier Vilela <ranier.vf@gmail.com> wrote:
>
> Hi,
>
> Per Coverity.
>
> If has 0 full groups, "we don't need to do anything" and need goes to next.
> Otherwise a integer division by zero, can raise.
>
> comments extracted trom explain.c:
>  /*
> * Since we never have any prefix groups unless we've first sorted
> * a full groups and transitioned modes (copying the tuples into a
> * prefix group), we don't need to do anything if there were 0 full
> * groups.
> */

This does look like a fairly obvious thinko on my part, and the patch
looks correct to me.

Tomas: agreed?

Thanks,
James



pgsql-hackers by date:

Previous
From: Ranier Vilela
Date:
Subject: Re: [PATCH] Fix possible overflow on tuplesort.c
Next
From: Andres Freund
Date:
Subject: Re: backup manifests