Tom Lane <t...@sss.pgh.pa.us> writes:

> I wonder if we shouldn't just do
>
>       RangeTblEntry *rte PG_USED_FOR_ASSERTS_ONLY;
>       ListCell   *lc;
>  
>       /* 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
>
> and eat the "useless" calculation of rte.

Why bother with the 'rte' variable at all if it's only used for the
Assert()ing the rtekind?

    Assert(planner_rt_fetch(rel->relid, root)->rtekind == RTE_SUBQUERY);

- ilmari

-- 
"The surreality of the universe tends towards a maximum" -- Skud's Law
"Never formulate a law or axiom that you're not prepared to live with
 the consequences of."                              -- Skud's Meta-Law


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to