Define variable only in the scope that needs it

From: Antonin Houska <ah(at)cybertec(dot)at>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Define variable only in the scope that needs it
Date: 2018-03-20 11:11:17
Message-ID: 31698.1521544277@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I suppose the current definition in the higher scope is not intentional. This
is what I suggest:

diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
new file mode 100644
index 9c4a1ba..ae35e1e
*** a/src/backend/optimizer/plan/planner.c
--- b/src/backend/optimizer/plan/planner.c
*************** create_ordinary_grouping_paths(PlannerIn
*** 3837,3843 ****
{
Query *parse = root->parse;
Path *cheapest_path = input_rel->cheapest_total_path;
- AggClauseCosts agg_partial_costs; /* parallel only */
AggClauseCosts agg_final_costs; /* parallel only */
double dNumGroups;
bool can_hash;
--- 3837,3842 ----
*************** create_ordinary_grouping_paths(PlannerIn
*** 3904,3909 ****
--- 3903,3909 ----
if (try_parallel_aggregation)
{
PathTarget *partial_grouping_target;
+ AggClauseCosts agg_partial_costs; /* parallel only */

/*
* Build target list for partial aggregate paths. These paths cannot

--
Antonin Houska
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26, A-2700 Wiener Neustadt
Web: https://www.cybertec-postgresql.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Eren Başak 2018-03-20 11:12:17 Re: [HACKERS] Optional message to user when terminating/cancelling backend
Previous Message Amit Langote 2018-03-20 11:07:06 Re: [HACKERS] path toward faster partition pruning