postgresql/src/bin
Tomas Vondra 00d9dcf5be pg_dump: Fix gzip compression of empty data
The pg_dump Compressor API has three basic callbacks - Allocate, Write
and End.  The gzip implementation (since e9960732a) wrongly assumed the
Write function would always be called, and deferred the initialization
of the internal compression system until the first such call.  But when
there's no data to compress (e.g. for empty LO), this would result in
not finalizing the compression state (because it was not actually
initialized), producing invalid dump.

Fixed by initializing the internal compression system in the Allocate
call, whenever the caller provides the Write.  For decompression the
state is not needed, so we leave the private_data member unpopulated.

Introduces a pg_dump TAP test compressing an empty large object.

This also rearranges the functions to their original order, to make
diffs against older code simpler to understand.  Finally, replace an
unreachable pg_fatal() with a simple assert check.

Reported-by: Justin Pryzby
Author: Justin Pryzby, Georgios Kokolatos
Reviewed-by: Georgios Kokolatos, Tomas Vondra

https://postgr.es/m/20230228235834.GC30529%40telsasoft.com
2023-03-29 02:34:48 +02:00
..
initdb Validate ICU locales. 2023-03-28 16:34:29 -07:00
pg_amcheck amcheck: Generalize one of the recently-added update chain checks. 2023-03-27 13:37:16 -04:00
pg_archivecleanup meson: add install-{quiet, world} targets 2023-03-23 21:20:18 -07:00
pg_basebackup meson: add install-{quiet, world} targets 2023-03-23 21:20:18 -07:00
pg_checksums meson: add install-{quiet, world} targets 2023-03-23 21:20:18 -07:00
pg_config meson: add install-{quiet, world} targets 2023-03-23 21:20:18 -07:00
pg_controldata meson: add install-{quiet, world} targets 2023-03-23 21:20:18 -07:00
pg_ctl meson: add install-{quiet, world} targets 2023-03-23 21:20:18 -07:00
pg_dump pg_dump: Fix gzip compression of empty data 2023-03-29 02:34:48 +02:00
pg_resetwal meson: add install-{quiet, world} targets 2023-03-23 21:20:18 -07:00
pg_rewind meson: add install-{quiet, world} targets 2023-03-23 21:20:18 -07:00
pg_test_fsync meson: add install-{quiet, world} targets 2023-03-23 21:20:18 -07:00
pg_test_timing meson: add install-{quiet, world} targets 2023-03-23 21:20:18 -07:00
pg_upgrade meson: add install-{quiet, world} targets 2023-03-23 21:20:18 -07:00
pg_verifybackup meson: add install-{quiet, world} targets 2023-03-23 21:20:18 -07:00
pg_waldump meson: add install-{quiet, world} targets 2023-03-23 21:20:18 -07:00
pgbench pgbench: Prepare commands in pipelines in advance 2023-02-21 10:56:37 +01:00
pgevent Update copyright for 2023 2023-01-02 15:00:37 -05:00
psql Invent GENERIC_PLAN option for EXPLAIN. 2023-03-24 17:07:22 -04:00
scripts meson: add install-{quiet, world} targets 2023-03-23 21:20:18 -07:00
Makefile Update copyright for 2023 2023-01-02 15:00:37 -05:00
meson.build Update copyright for 2023 2023-01-02 15:00:37 -05:00