Re: [HACKERS] Compiler warning in costsize.c - Mailing list pgsql-hackers

From ilmari@ilmari.org (Dagfinn Ilmari Mannsåker)
Subject Re: [HACKERS] Compiler warning in costsize.c
Date
Msg-id d8j60icrxh6.fsf@dalvik.ping.uio.no
Whole thread Raw
In response to Re: [HACKERS] Compiler warning in costsize.c  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] Compiler warning in costsize.c  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane <tgl@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 withthe consequences of."
--Skud's Meta-Law
 



pgsql-hackers by date:

Previous
From: Stas Kelvich
Date:
Subject: Re: [HACKERS] logical replication worker and statistics
Next
From: Fujii Masao
Date:
Subject: [HACKERS] tablesync patch broke the assumption that logical rep depends on?