Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com> writes:> here's my proposed fix.
Looks sane by eyeball (didn't test it).
regards, tom lane