plpgsql's exec_simple_cast_value() mistakenly supposed that it could bypass
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 2 Apr 2009 01:16:11 +0000 (01:16 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 2 Apr 2009 01:16:11 +0000 (01:16 +0000)
commit48534551a1d70f524fd04cb16717224fe6983457
tree323515a9e069db65d74b7d346fd6ee2e3c81e980
parente4216c5e872174175e94d9117d9a7a06e81c65ff
plpgsql's exec_simple_cast_value() mistakenly supposed that it could bypass
casting effort whenever the input value was NULL.  However this prevents
application of not-null domain constraints in the cases that use this
function, as illustrated in bug #4741.  Since this function isn't meant
for use in performance-critical paths anyway, this certainly seems like
another case of "premature optimization is the root of all evil".

Back-patch as far as 8.2; older versions made no effort to enforce
domain constraints here anyway.
src/pl/plpgsql/src/pl_exec.c