plpgsql's exec_simple_cast_value() mistakenly supposed that it could bypass
authorTom Lane <[email protected]>
Thu, 2 Apr 2009 01:16:17 +0000 (01:16 +0000)
committerTom Lane <[email protected]>
Thu, 2 Apr 2009 01:16:17 +0000 (01:16 +0000)
commit95dc6da685e90a520f9dcdd0e6060a87c0646336
tree924ed881cf5c3110b7775edceea2098fa77a8bf2
parent64f25a61d58c7a107a9f07382f622090c0a273d5
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