compiler warning in set_tablefunc_size_estimates

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: compiler warning in set_tablefunc_size_estimates
Date: 2017-03-09 21:05:14
Message-ID: CA+TgmoaWP9qN1mWhu1uwtt6mTEPfjL734Apru2iVMKFjYKNuHQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I tried a non-cassert compile on a machine that has a pickier compiler
than my laptop, and got:

costsize.c: In function ‘set_tablefunc_size_estimates’:
costsize.c:4574:17: error: variable ‘rte’ set but not used
[-Werror=unused-but-set-variable]

That appears to be a legitimate gripe. Perhaps:

diff --git a/src/backend/optimizer/path/costsize.c
b/src/backend/optimizer/path/costsize.c
index e78f3a8..c23f681 100644
--- a/src/backend/optimizer/path/costsize.c
+++ b/src/backend/optimizer/path/costsize.c
@@ -4571,12 +4571,9 @@ set_function_size_estimates(PlannerInfo *root,
RelOptInfo *rel)
void
set_tablefunc_size_estimates(PlannerInfo *root, RelOptInfo *rel)
{
- RangeTblEntry *rte;
-
/* Should only be applied to base relations that are functions */
Assert(rel->relid > 0);
- rte = planner_rt_fetch(rel->relid, root);
- Assert(rte->rtekind == RTE_TABLEFUNC);
+ Assert(planner_rt_fetch(rel->relid, root)->rtekind == RTE_TABLEFUNC);

rel->tuples = 100;

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2017-03-09 21:06:07 Re: WIP: [[Parallel] Shared] Hash
Previous Message Andrew Dunstan 2017-03-09 21:05:10 alter enum add value regression