Dave,
Certainly there might be a bug in the PG version. Is it still there?
Btw, you're right about the theory: the context_id should really be used for
permissions only. That's why I said that our use of context_id is correct in 90%
of cases, and not so correct in 10% of cases (but in those cases, the result is
still totally acceptable).
If you have a better suggestion for solving this problem, I'm absolutely up for a
better way to look at this stuff.