Avoid misbehavior in foreign key checks when casting to a datatype for which
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 7 Feb 2008 22:58:35 +0000 (22:58 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 7 Feb 2008 22:58:35 +0000 (22:58 +0000)
commit841106332b8c37d70c0177ec095a130f0a964dbc
treef2e2ac25c29f43965d63e3475e00a762d125fb56
parent61b6f59fdd4d9e7b1a7828fdc08930868e74929e
Avoid misbehavior in foreign key checks when casting to a datatype for which
the parser supplies a default typmod that can result in data loss (ie,
truncation).  Currently that appears to be only CHARACTER and BIT.
We can avoid the problem by specifying the type's internal name instead
of using SQL-spec syntax.  Since the queries generated here are only used
internally, there's no need to worry about portability.  This problem is
new in 8.3; before we just let the parser do whatever it wanted to resolve
the operator, but 8.3 is trying to be sure that the semantics of FK checks
are consistent.  Per report from Harald Fuchs.
src/backend/utils/adt/ri_triggers.c