shihao zhong <zhong950419(at)gmail(dot)com> writes:
> If I understand correctly, you mean the following case,
> A table t with 100 rows,
> SELECT count(*) FROM t WHERE (SELECT random()) < 0.5;
> returns either 100 or 0, because the sub-select runs only once.
Right.
> I think technically that is one of the correct answers....It is just a
> result the caller would almost never see otherwise.
> I am okay to revert the patch..
To be clear, I'm fine with 27c844034 as it stands. I just don't think
it'd be consistent with our past practice to extend the volatility
check into subplans.
regards, tom lane