]> granicus.if.org Git - postgresql/commit
Don't believe MinMaxExpr is leakproof without checking.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 2 Jan 2019 21:33:48 +0000 (16:33 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 2 Jan 2019 21:33:48 +0000 (16:33 -0500)
commit64edc788b4a509427eb407b0d8faac75bac5e02b
treecc025f197bed1846ac49b053c6fe8ed6eb857d37
parentafd090a00d50efa807e5f286c27d6d916c24590e
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: https://postgr.es/m/31042.1546194242@sss.pgh.pa.us
src/backend/optimizer/util/clauses.c