Division by zero in planner.c:grouping_planner()

From: Piotr Stefaniak <postgres(at)piotr-stefaniak(dot)me>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Division by zero in planner.c:grouping_planner()
Date: 2015-07-29 18:26:55
Message-ID: BLU436-SMTP73C3D863C3D43CA54AAD7AF28C0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

with the change below, make installcheck fails -- at the updatable_views
step, I believe. Apparently it's the "SELECT * FROM v1 WHERE a=3;" that
triggers this.

diff --git a/src/backend/optimizer/plan/planner.c
b/src/backend/optimizer/plan/planner.c
index 6ee411e..cbdee7c 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -1661,6 +1661,7 @@ grouping_planner(PlannerInfo *root, double
tuple_fraction)
* Plain non-grouped, non-aggregated query: an
absolute tuple
* fraction can be divided by the number of tuples.
*/
+ Assert(path_rows != 0);
if (tuple_fraction >= 1.0)
tuple_fraction /= path_rows;
}

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2015-07-29 18:35:00 Re: LWLock deadlock and gdb advice
Previous Message Andres Freund 2015-07-29 18:18:49 Re: Reduce ProcArrayLock contention