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

From Robert Haas
Subject Re: [HACKERS] Compiler warning in costsize.c
Date
Msg-id CA+TgmoYdB0LrgMC9511Wri3tB2D+dp9rz5W6doHs6MbLjjsD3w@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] Compiler warning in costsize.c  (Michael Paquier <michael.paquier@gmail.com>)
Responses Re: [HACKERS] Compiler warning in costsize.c  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Mon, Apr 10, 2017 at 8:30 AM, Michael Paquier
<michael.paquier@gmail.com> wrote:
> On Mon, Apr 10, 2017 at 9:05 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> 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.
>
> That works as well. Now this code really has been written so as we
> don't want to do this useless computation for non-Assert builds,
> that's why I did not suggest it. But as it does just a list_nth call,
> that's not really costly... And other code paths dealing with the cost
> do it as well.

-1 from me.  I'm not a big fan of useless calculation just because it
happens to be needed in an Assert-enabled build.

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



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [HACKERS] tuple-routing and constraint violation error message, revisited
Next
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] logical replication worker and statistics