Don't believe MinMaxExpr is leakproof without checking.
Don't believe MinMaxExpr is leakproof without checking.

MinMaxExpr invokes the btree comparison function for its input datatype,
so it's only leakproof if that function is.  Many such functions are
indeed leakproof, but others are not, and we should not just assume that
they are.  Hence, adjust contain_leaked_vars to verify the leakproofness
of the referenced function explicitly.

I didn't add a regression test because it would need to depend on
some particular comparison function being leaky, and that's a moving
target, per discussion.

This has been wrong all along, so back-patch to supported branches.

Discussion: d06c506f7fee2c996a30eafbc30509bb6b0d932d@sss.pgh.pa.us

adam8157/gpdb,lisakowen/gpdb,lisakowen/gpdb,greenplum-db/gpdb,greenplum-db/gpdb,xinzweb/gpdb,adam8157/gpdb,adam8157/gpdb,xinzweb/gpdb,greenplum-db/gpdb,greenplum-db/gpdb,xinzweb/gpdb,adam8157/gpdb,greenplum-db/gpdb,xinzweb/gpdb,xinzweb/gpdb,lisakowen/gpdb,50wu/gpdb,greenplum-db/gpdb,adam8157/gpdb,lisakowen/gpdb,adam8157/gpdb,adam8157/gpdb,greenplum-db/gpdb,50wu/gpdb,lisakowen/gpdb,xinzweb/gpdb,lisakowen/gpdb,50wu/gpdb,adam8157/gpdb,50wu/gpdb,greenplum-db/gpdb,lisakowen/gpdb,50wu/gpdb,xinzweb/gpdb,50wu/gpdb,lisakowen/gpdb,50wu/gpdb,50wu/gpdb,xinzweb/gpdb