Craig Ringer <[email protected]> writes:
> On 24 June 2016 at 21:34, Tom Lane <[email protected]> wrote:
>> TBH, this looks more like a compiler bug than anything else.
> I tend to agree. Especially since valgrind has no complaints on x64 linux,
> and neither does DrMemory for 32-bit builds with the same toolchain on the
> same Windows and same SDK.
If that is the explanation, I'm suspicious that it's got something to do
with the interaction of a static inline-able (single-call-site) function
and taking the address of a formal parameter. We certainly have multiple
other instances of each thing, but maybe not both at the same place.
This leads to a couple of suggestions for dodging the problem:
1. Make get_foreign_key_join_selectivity non-static so that it doesn't
get inlined, along the lines of
List *restrictlist);
-static Selectivity get_foreign_key_join_selectivity(PlannerInfo *root,
+extern Selectivity get_foreign_key_join_selectivity(PlannerInfo *root,
Relids
outer_relids,
...
*/
-static Selectivity
+Selectivity
get_foreign_key_join_selectivity(PlannerInfo *root,
2. Don't pass the original formal parameter to
get_foreign_key_join_selectivity, ie do something like
static double
calc_joinrel_size_estimate(PlannerInfo *root,
RelOptInfo *outer_rel,
RelOptInfo *inner_rel,
double outer_rows,
double inner_rows,
SpecialJoinInfo *sjinfo,
- List *restrictlist)
+ List *orig_restrictlist)
{
JoinType jointype = sjinfo->jointype;
+ List *restrictlist = orig_restrictlist;
Selectivity fkselec;
Selectivity jselec;
Selectivity pselec;
Obviously, if either of those things do make the problem go away, it's
a compiler bug. If not, we'll need to dig deeper.
regards, tom lane
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers