Hello Ralph,
Without looking at the code, it will be hard to understand the problem.
Did you try to execute block independently out of postscript, to see if error persists?
Also, please try to create a procedure in the database and call procedure with "call proc();" in post-hook, to see if it make any difference.
~Thanks
Jatinder