Qingqing Zhou <zhouqq.postgres@gmail.com> writes:
> On Sat, Apr 4, 2015 at 4:55 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> (This is somewhat overkill, in that a strict expression could still be
>> matched, but it doesn't seem worth the effort to check that.)
> Just curious, checking an expression strictness is convenient in
> build_tlist_index() like this:
> TargetEntry *tle = (TargetEntry *) lfirst(l);
> + if (contain_nonstrict_functions((Node *)tle))
> + *hasnonstrict = true;
> +
> And this will almost avoid the overkill at once. Why not do this?
Because it's expensive (a syscache lookup per function or operator).
And that test alone would be insufficient anyway: you'd also have to
check that there was an appropriate Var in the expression, cf the
comment for contain_nonstrict_functions.
regards, tom lane