Reputation: 1506
I've installed PGXN Client but everytime I run
$ pgxn install pg_repack
make[1]: Entering directory '/tmp/tmpniazqt/pg_repack-1.4.4/bin' gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -I/usr/include/postgresql -DREPACK_VERSION=1.4.4 -I. -I./ -I/usr/include/postgresql/11/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include/mit-krb5 -c -o pg_repack.o pg_repack.c gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -I/usr/include/postgresql -DREPACK_VERSION=1.4.4 -I. -I./ -I/usr/include/postgresql/11/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include/mit-krb5 -c -o pgut/pgut.o pgut/pgut.c gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -I/usr/include/postgresql -DREPACK_VERSION=1.4.4 -I. -I./ -I/usr/include/postgresql/11/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include/mit-krb5 -c -o pgut/pgut-fe.o pgut/pgut-fe.c gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer pg_repack.o pgut/pgut.o pgut/pgut-fe.o -L/usr/lib/x86_64-linux-gnu -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -L/usr/lib/llvm-6.0/lib -L/usr/lib/x86_64-linux-gnu/mit-krb5 -Wl,--as-needed -L/usr/lib/x86_64-linux-gnu -lpq -L/usr/lib/postgresql/11/lib -lpgcommon -lpgport -lpthread -lssl -lcrypto -lz -lrt -lcrypt -ldl -lm -o pg_repack /usr/bin/ld: cannot find -lz collect2: error: ld returned 1 exit status /usr/lib/postgresql/11/lib/pgxs/src/makefiles/pgxs.mk:430: recipe for target 'pg_repack' failed make[1]: * [pg_repack] Error 1 make[1]: Leaving directory '/tmp/tmpniazqt/pg_repack-1.4.4/bin' Makefile:35: recipe for target 'all' failed make: * [all] Error 2 ERROR: command returned 2: make PG_CONFIG=/usr/bin/pg_config all
I also tried installing it by downloading the pg_repack.zip but still get the same error.
I guess there's something in the makefile that I need to edit. But I can't seem to point out what it is.
Thank you in advance!
Upvotes: 1
Views: 2378
Reputation: 123
Below are the steps, we can follow to setup pg_repack
CREATE EXTENSION pg_repack
.sudo apt-get install postgresql-12-repack
pg_repack --dry-run -d <DATABASE NAME> --table <TABLE NAME>
This command will print what would have been repackedpg_repack -d <DATABASE_NAME> -U <USERNAME> -h <DATABASE_HOST_URL> -p <DATABASE_PORT> -k
For more details check this blog
Update:
If you encounter difficulties installing pg_repack (v1.4.8) with the latest PostgreSQL version (v15), refer to this solution.
Upvotes: 2