Tried the patch, but I'm afraid it made no difference in the temporary tables case. Tried adding a check that relation persistence was logged that was in the same vein to the one in the patch (figured the problem could also occur for non-temporary tables that were unlogged, but haven't checked) but that made no difference either. I stopped tinkering at that point cos I don't really know what I'm doing.