aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2017-03-13 18:54:35 -0300
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2017-03-13 19:02:38 -0300
commita9c074ba7ec2827832c2f5e2fa0de16bf4851b9b (patch)
tree19a92d183f87aa776e22dfe97db495a936e878c3
parent895e36bb3f36fdb7ec8e573be1a20d104fac820b (diff)
downloadpostgresql-a9c074ba7ec2827832c2f5e2fa0de16bf4851b9b.tar.gz
postgresql-a9c074ba7ec2827832c2f5e2fa0de16bf4851b9b.zip
Silence unused variable compiler warning
Fallout from fcec6caafa2: mark a variable in set_tablefunc_size_estimates as used for asserts only. Also, the planner_rte_fetch() call is pointless with assertions disabled, so enclose it in a USE_ASSERT_CHECKING #ifdef; fix the same problem in set_subquery_size_estimates(). First problem noted by David Rowley, whose compiler is noisier than mine in this regard.
-rw-r--r--src/backend/optimizer/path/costsize.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c
index e78f3a84c50..88835862022 100644
--- a/src/backend/optimizer/path/costsize.c
+++ b/src/backend/optimizer/path/costsize.c
@@ -4458,8 +4458,10 @@ set_subquery_size_estimates(PlannerInfo *root, RelOptInfo *rel)
/* Should only be applied to base relations that are subqueries */
Assert(rel->relid > 0);
+#ifdef USE_ASSERT_CHECKING
rte = planner_rt_fetch(rel->relid, root);
Assert(rte->rtekind == RTE_SUBQUERY);
+#endif
/*
* Copy raw number of output rows from subquery. All of its paths should
@@ -4571,12 +4573,14 @@ set_function_size_estimates(PlannerInfo *root, RelOptInfo *rel)
void
set_tablefunc_size_estimates(PlannerInfo *root, RelOptInfo *rel)
{
- RangeTblEntry *rte;
+ RangeTblEntry *rte PG_USED_FOR_ASSERTS_ONLY;
/* Should only be applied to base relations that are functions */
Assert(rel->relid > 0);
+#ifdef USE_ASSERT_CHECKING
rte = planner_rt_fetch(rel->relid, root);
Assert(rte->rtekind == RTE_TABLEFUNC);
+#endif
rel->tuples = 100;