Re: Compiler warning in costsize.c

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Compiler warning in costsize.c
Date: 2017-04-10 12:30:25
Message-ID: CAB7nPqSMde54u5Zh=cbAiQe9BcGia+04zpDPL5+juPyWuvY7ZA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Apr 10, 2017 at 9:05 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Petr Jelinek 2017-04-10 12:32:55 Re: max_sync_workers_per_subscription is missing in postgresql.conf
Previous Message Petr Jelinek 2017-04-10 12:29:48 Re: logical replication and SIGHUP