Idly thumbing through the code, I came across something that might possibly explain your results. Do the rows being updated contain NULLs in the foreign-key columns? I see that ri_KeysEqual() treats two null values as not equal, which might be overzealous respect for SQL null semantics in this context.
regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq