Re: [PATCH] Fix division by zero (explain.c)
От
Tomas Vondra
Тема
Re: [PATCH] Fix division by zero (explain.c)
Дата
Msg-id
20200509174440.hvzrifqtu7fhbnkq@development
Ответ на
Re: [PATCH] Fix division by zero (explain.c) (Ranier Vilela)
Список
Дерево обсуждения
[PATCH] Fix division by zero (explain.c) Ranier Vilela <ranier.vf@gmail.com>
Re: [PATCH] Fix division by zero (explain.c) James Coleman <jtc331@gmail.com>
Re: [PATCH] Fix division by zero (explain.c) Tomas Vondra <tomas.vondra@2ndquadrant.com>
Re: [PATCH] Fix division by zero (explain.c) Ranier Vilela <ranier.vf@gmail.com>
Re: [PATCH] Fix division by zero (explain.c) Tomas Vondra <tomas.vondra@2ndquadrant.com>
Re: [PATCH] Fix division by zero (explain.c) James Coleman <jtc331@gmail.com>
Re: [PATCH] Fix division by zero (explain.c) Tom Lane <tgl@sss.pgh.pa.us>
Re: [PATCH] Fix division by zero (explain.c) Ranier Vilela <ranier.vf@gmail.com>
Re: [PATCH] Fix division by zero (explain.c) Tomas Vondra <tomas.vondra@2ndquadrant.com>
Re: [PATCH] Fix division by zero (explain.c) Ranier Vilela <ranier.vf@gmail.com>
Re: [PATCH] Fix division by zero (explain.c) Tomas Vondra <tomas.vondra@2ndquadrant.com>
Re: [PATCH] Fix division by zero (explain.c) Ranier Vilela <ranier.vf@gmail.com>
Re: [PATCH] Fix division by zero (explain.c) Tomas Vondra <tomas.vondra@2ndquadrant.com>
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 escreveu:
>
>> James Coleman 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.
regards
--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
В списке pgsql-hackers по дате отправления