I wrote: > Isn't the real problem that lo_write returns int, not size_t?
After looking at it some more, I decided that we'd just been lazy to begin with: we should be handling this as a regular SQL error condition. Pushed at 929c69aa19. regards, tom lane