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

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, James Coleman <jtc331(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] Fix division by zero (explain.c)
Date: 2020-05-09 17:51:50
Message-ID: CAEudQAq3S16UiEa008Wi=4VQnLsW5c9MzC9zOON2MjbWj7Dm+Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em sáb., 9 de mai. de 2020 às 14:44, Tomas Vondra <
tomas(dot)vondra(at)2ndquadrant(dot)com> escreveu:

> On Sat, May 09, 2020 at 06:48:59AM -0300, Ranier Vilela wrote:
> >Em sáb., 9 de mai. de 2020 às 01:45, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
> escreveu:
> >
> >> James Coleman <jtc331(at)gmail(dot)com> writes:
> >> > There are always full sort groups before any prefix groups can happen,
> >> > so we know (even though the tooling doesn't) that the 2nd test can
> >> > never contradict the first.
> >>
> >> So maybe an assertion enforcing that would be appropriate?
> >> Untested, but:
> >>
> >> - if (fullsortGroupInfo->groupCount == 0 &&
> >> - prefixsortGroupInfo->groupCount == 0)
> >> + if (fullsortGroupInfo->groupCount == 0)
> >> + {
> >> + Assert(prefixsortGroupInfo->groupCount
> ==
> >> 0);
> >> continue;
> >> + }
> >>
> >I agree, asserts always help.
> >
>
> That doesn't work, because the prefixSortGroupInfo is used before
> assignment, producing compile-time warnings.
>
> I've pushed a simpler fix without the assert. If we want to make this
> check, perhaps doing it in incremental sort itself would be better than
> doing it in explain.
>
Thanks anyway for the commit.
But if you used the first version of my patch, would the author be me and
am I as reported?
What does it take to be considered the author?

regards,
Ranier Vilela

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-05-09 18:09:01 Re: Another modest proposal for docs formatting: catalog descriptions
Previous Message Andres Freund 2020-05-09 17:48:20 Add -Wold-style-definition to CFLAGS?