Patch in #6915 works for me too. Many thanks for your help.
I'm using DBD::Pg 2.17.1
1.3.38 Posting Receipt gives Internal Server Error
Internal Server Error on delete account
[patch] Printed Sales Invoice differs from Posted (reopen of 864)
[patch attached] The fix committed in svn 6407 and 6408 does not cater for the situation...