Explain output would also be useful. I would wonder if it's a problem with a hash that misestimated the necessary size; you might see if analyzing the tables involved changes its behavior.
I executed ANALYZE just before running the problematic statement. Will post the output of EXPLAIN, if no other explanation comes up.
---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings