Re: [PATCH] Fix division by zero (explain.c)

From: James Coleman <jtc331(at)gmail(dot)com>
To: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
Subject: Re: [PATCH] Fix division by zero (explain.c)
Date: 2020-04-23 20:12:34
Message-ID: CAAaqYe-45WH4Shfxb-xtwEq=dVa-Tycwif+bpDK_cuu6O-ZM2Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Apr 23, 2020 at 8:38 AM Ranier Vilela <ranier(dot)vf(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2020-04-23 21:16:29 Re: backup manifests
Previous Message Ranier Vilela 2020-04-23 20:03:47 Re: [PATCH] Fix possible overflow on tuplesort.c