> On Oct 10, 2026, at 19:03, Zsolt Parragi <[email protected]> wrote:
> 
> Hello
> 
> An automatic post-commit claude review pointed out that this broke
> restoring directory format dumps with an empty large object, when
> compressed with zstd or lz4:
> 
>    SELECT lo_create(0);
> 
>    $ pg_dump -Fd -Z zstd -f dump postgres
>    $ pg_restore -f /dev/null dump
>    pg_restore: error: could not decompress data: compressed stream is
> incomplete
> 
>    $ pg_dump -Fd -Z lz4 -f dump postgres
>    $ pg_restore -f /dev/null dump
>    pg_restore: error: could not read from input file: Input/output error
>    pg_restore: error: could not read from input file: Input/output error
> 
> The compressed file handles only start a frame on the first write, so
> the blob_NNN.dat.zst/.lz4 file of an empty large object is 0 bytes,
> and the new check treats that as a truncated stream. Custom format and
> gzip are fine.
> 
> The attached patch makes the reader accept a file with no input at all
> as a complete stream, a stream that started a frame and then stopped
> is still rejected.
> <v1-0001-pg_dump-Fix-restore-of-empty-zstd-and-LZ4-data-fi.patch>

Thanks for the post-commit verification.

I agree with your analysis and the fix. Initializing frame_finished to true 
allows the reader to handle an empty input file.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/






Reply via email to