Actually looking again, getRecordTimestamp is looking pretty strange. It looks much more natural by using nested switch/case blocks, as with this diff. I think the compiler does a better job this way too.
-- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services