Bug 287225 - databases/postgresql17-client: should support zstd compression in client, not only in the server
Summary: databases/postgresql17-client: should support zstd compression in client, not...
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Palle Girgensohn
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-06-01 23:40 UTC by Trond Endrestøl
Modified: 2025-06-09 20:18 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (pgsql)


Attachments
Patch for databases/postgresql17-server/Makefile allowing LZ4 and ZSTD for both client and server (1.31 KB, patch)
2025-06-03 19:27 UTC, Trond Endrestøl
no flags Details | Diff
Patch for databases/postgresql1{6,7,8}-server/Makefile allowing LZ4 and ZSTD for both client and server (3.92 KB, patch)
2025-06-04 07:50 UTC, Trond Endrestøl
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Trond Endrestøl 2025-06-01 23:40:54 UTC
This might be due to pilot error, but shouldn't pg_dump support zstd? It's mentioned in the manpage. I have zstd enabled in the server, so maybe zstd should be an option in postgresql*-client, where applicable.

     -Z level
     -Z method[:detail]
     --compress=level
     --compress=method[:detail]
         Specify the compression method and/or the compression level to use.
         The compression method can be set to gzip, lz4, zstd, or none for no
         compression. A compression detail string can optionally be specified.
         If the detail string is an integer, it specifies the compression
         level. Otherwise, it should be a comma-separated list of items, each
         of the form keyword or keyword=value. Currently, the supported
         keywords are level and long.

         If no compression level is specified, the default compression level
         will be used. If only a level is specified without mentioning an
         algorithm, gzip compression will be used if the level is greater than
         0, and no compression will be used if the level is 0.

         For the custom and directory archive formats, this specifies
         compression of individual table-data segments, and the default is to
         compress using gzip at a moderate level. For plain text output,
         setting a nonzero compression level causes the entire output file to
         be compressed, as though it had been fed through gzip, lz4, or zstd;
         but the default is not to compress. With zstd compression, long mode
         may improve the compression ratio, at the cost of increased memory
         use.

         The tar archive format currently does not support compression at all.

trond@E590T:~/sql/portsbuildstats>pg_dump -f portsbuildstats.dump.sql.zst -Z zstd:19 portsbuildstats
pg_dump: error: invalid compression specification: this build does not support compression with ZSTD

trond@E590T:~/sql/portsbuildstats>pkg which `which pg_dump`
/usr/local/bin/pg_dump was installed by package postgresql17-client-17.5

trond@E590T:~/sql/portsbuildstats>pkg info postgresql17-client
postgresql17-client-17.5
Name           : postgresql17-client
Version        : 17.5
Installed on   : Sat May 24 14:22:14 2025 CEST
Origin         : databases/postgresql17-client
Architecture   : FreeBSD:15:amd64
Prefix         : /usr/local
Categories     : databases
Licenses       : PostgreSQL
Maintainer     : pgsql@FreeBSD.org
WWW            : https://www.postgresql.org/
Comment        : PostgreSQL database (client)
Options        :
        DEBUG          : off
        DOCS           : on
        GSSAPI         : off
        LIBEDIT        : off
        NLS            : off
        OPTIMIZED_CFLAGS: on
        PAM            : off
        SSL            : on
Shared Libs required:
        libc.so.7
        libcrypto.so.30
        libm.so.5
        libreadline.so.8
        libssl.so.30
        libthr.so.3
        libz.so.6
Shared Libs provided:
        libecpg.so.6
        libecpg_compat.so.3
        libpgtypes.so.3
        libpq.so.5
Annotations    :
        FreeBSD_version: 1500036
        cpe            : cpe:2.3:a:postgresql:postgresql:17.5:::::freebsd15:x64
        repo_type      : binary
        repository     : Synth
Flat size      : 12.2MiB
Description    :
PostgreSQL is a sophisticated Object-Relational DBMS, supporting
almost all SQL constructs, including subselects, transactions, and
user-defined types and functions. It is the most advanced open-source
database available anywhere. Commercial Support is also available.

The original Postgres code was the effort of many graduate students,
undergraduate students, and staff programmers working under the direction of
Professor Michael Stonebraker at the University of California, Berkeley. In
1995, Andrew Yu and Jolly Chen took on the task of converting the DBMS query
language to SQL and created a new database system which came to known as
Postgres95. Many others contributed to the porting, testing, debugging and
enhancement of the Postgres95 code. As the code improved, and 1995 faded into
memory, PostgreSQL was born.

PostgreSQL development is presently being performed by a team of Internet
developers who are now responsible for all current and future development. The
development team coordinator is Marc G. Fournier (scrappy@PostgreSQL.ORG).
Support is available from the PostgreSQL developer/user community through the
support mailing list (questions@PostgreSQL.ORG).

PostgreSQL is free and the complete source is available.

trond@E590T:~/sql/portsbuildstats>pkg info postgresql17-server
postgresql17-server-17.5
Name           : postgresql17-server
Version        : 17.5
Installed on   : Sat May 24 14:25:48 2025 CEST
Origin         : databases/postgresql17-server
Architecture   : FreeBSD:15:amd64
Prefix         : /usr/local
Categories     : databases
Licenses       : PostgreSQL
Maintainer     : pgsql@FreeBSD.org
WWW            : https://www.postgresql.org/
Comment        : PostgreSQL is the most advanced open-source database available anywhere
Options        :
        DEBUG          : off
        DOCS           : on
        DTRACE         : on
        GSSAPI         : off
        LDAP           : off
        LLVM           : on
        LZ4            : on
        NLS            : off
        OPTIMIZED_CFLAGS: on
        PAM            : off
        SSL            : on
        TZDATA         : off
        XML            : off
        ZSTD           : on
Shared Libs required:
        libLLVM.so.19.1
        libc++.so.1
        libc.so.7
        libcrypto.so.30
        libcxxrt.so.1
        libelf.so.2
        libexecinfo.so.1
        libgcc_s.so.1
        libicui18n.so.76
        libicuuc.so.76
        liblz4.so.1
        libm.so.5
        libpq.so.5
        libssl.so.30
        libthr.so.3
        libz.so.6
        libzstd.so.1
Annotations    :
        FreeBSD_version: 1500036
        cpe            : cpe:2.3:a:postgresql:postgresql:17.5:::::freebsd15:x64
        repo_type      : binary
        repository     : Synth
Flat size      : 35.8MiB
Description    :
PostgreSQL is a sophisticated Object-Relational DBMS, supporting
almost all SQL constructs, including subselects, transactions, and
user-defined types and functions. It is the most advanced open-source
database available anywhere. Commercial Support is also available.

The original Postgres code was the effort of many graduate students,
undergraduate students, and staff programmers working under the direction of
Professor Michael Stonebraker at the University of California, Berkeley. In
1995, Andrew Yu and Jolly Chen took on the task of converting the DBMS query
language to SQL and created a new database system which came to known as
Postgres95. Many others contributed to the porting, testing, debugging and
enhancement of the Postgres95 code. As the code improved, and 1995 faded into
memory, PostgreSQL was born.

PostgreSQL development is presently being performed by a team of Internet
developers who are now responsible for all current and future development. The
development team coordinator is Marc G. Fournier (scrappy@PostgreSQL.ORG).
Support is available from the PostgreSQL developer/user community through the
support mailing list (questions@PostgreSQL.ORG).

PostgreSQL is free and the complete source is available.
Comment 1 Trond Endrestøl 2025-06-03 19:27:09 UTC
Created attachment 260945 [details]
Patch for databases/postgresql17-server/Makefile allowing LZ4 and ZSTD for both client and server
Comment 2 Trond Endrestøl 2025-06-04 07:50:47 UTC
Created attachment 260961 [details]
Patch for databases/postgresql1{6,7,8}-server/Makefile allowing LZ4 and ZSTD for both client and server

I just realised I need to repeat my changes on databases/postgresql16-server and databases/postgresql18-server.
Comment 3 Palle Girgensohn freebsd_committer freebsd_triage 2025-06-09 20:17:39 UTC
Gee, thanks, I really missed to verify this feature. Quite good stuff for pg_dump. [1]

I think the penalty for including archivers/zstd is small enough to also let it be on per default.


[1] https://www.cybertec-postgresql.com/en/lz4-zstd-pg_dump-compression-postgresql-16/