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

From Tom Lane
Subject Re: [PATCH] Fix division by zero (explain.c)
Date
Msg-id 16267.1588999511@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PATCH] Fix division by zero (explain.c)  (James Coleman <jtc331@gmail.com>)
Responses Re: [PATCH] Fix division by zero (explain.c)  (Ranier Vilela <ranier.vf@gmail.com>)
List pgsql-hackers
James Coleman <jtc331@gmail.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;
+            }

            regards, tom lane



pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Should smgrdounlink() be removed?
Next
From: Fujii Masao
Date:
Subject: Re: Back-branch minor release notes are up for review