Michael Paquier <michael.paqu...@gmail.com> writes: > Bah. This actually fixes nothing. Attached is a different patch that > really addresses the problem, by removing the variable because we > don't want planner_rt_fetch() to run for non-Assert builds.
I don't really like any of these fixes, because they take the code further away from the structure used by all the other similar functions in costsize.c, and they will be hard to undo whenever these functions grow a reason to look at the RTE normally (outside asserts). I'd be happier with something along the line of RangeTblEntry *rte; ListCell *lc; /* Should only be applied to base relations that are subqueries */ Assert(rel->relid > 0); rte = planner_rt_fetch(rel->relid, root); #ifdef USE_ASSERT_CHECKING Assert(rte->rtekind == RTE_SUBQUERY); #else (void) rte; /* silence unreferenced-variable complaints */ #endif assuming that that actually does silence the warning on MSVC. BTW, is it really true that only these two places produce such warnings on MSVC? I see about three dozen uses of PG_USED_FOR_ASSERTS_ONLY in our tree, and I'd have expected all of those places to be causing warnings on a compiler that doesn't have a way to understand that annotation. regards, tom lane -- Sent via pgsql-hackers mailing list (firstname.lastname@example.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers