diff --git a/src/components/PlanNodeDetail.vue b/src/components/PlanNodeDetail.vue
index ece979f5..857cd2a4 100644
--- a/src/components/PlanNodeDetail.vue
+++ b/src/components/PlanNodeDetail.vue
@@ -294,7 +294,7 @@ watch(activeTab, () => {
}"
>
-
+
{
+ test("Computes exclusive cost correctly", () => {
+ const planService = new PlanService()
+ const source = `Seq Scan on atividade_economica ae (cost=0.00..0.00 rows=1 width=36)`
+ const r = planService.fromSource(source) as IPlanContent
+ const plan: IPlan = planService.createPlan("", r, "")
+ const root = plan.content.Plan
+ root && expect(root["*Cost (exclusive)"]).toBe(0)
+ })
+})
diff --git a/src/services/plan-service.ts b/src/services/plan-service.ts
index 12e3937f..e505654b 100644
--- a/src/services/plan-service.ts
+++ b/src/services/plan-service.ts
@@ -233,7 +233,7 @@ export class PlanService {
node[NodeProp.EXCLUSIVE_DURATION] = duration > 0 ? duration : 0
}
- if (node[NodeProp.TOTAL_COST]) {
+ if (!_.isUndefined(node[NodeProp.TOTAL_COST])) {
node[NodeProp.EXCLUSIVE_COST] = node[NodeProp.TOTAL_COST]
}