I think the real problem here is that what the code is doing is precisely not what is documented in compress_io.h:
/* * Read 'size' bytes of data from the file and store them into 'ptr'. * Optionally it will store the number of bytes read in 'rsize'. * * Returns true on success and throws an internal error otherwise. */ bool (*read_func) (void *ptr, size_t size, size_t *rsize, CompressFileHandle *CFH); I've not checked to see what the other users of this API do, but if they're all like this then we need to fix that comment. Otherwise we probably need to make them all alike; even if there's not a bug today, one will soon appear from someone believing the comment. regards, tom lane