pg_repack: ERROR: query failed: ERROR: unexpected index definition
When I tried to repack my bloated table an error occurred:
postgres@db:~$ time /usr/lib/postgresql/9.6/bin/pg_repack -e --table party lexdb
LOG: (query) select repack.version(), repack.version_sql()
LOG: (query) SET statement_timeout = 0
LOG: (query) SET search_path = pg_catalog, pg_temp, public
LOG: (query) SET client_min_messages = warning
LOG: (query) SELECT t.*, coalesce(v.tablespace, t.tablespace_orig) as tablespace_dest FROM repack.tables t, (VALUES (quote_ident($1::text))) as v (tablespace) WHERE (relid = $2::regclass) ORDER BY t.relname, t.schemaname
LOG: (param:0) = (null)
LOG: (param:1) = party
INFO: repacking table "party"
LOG: (query) SELECT pg_try_advisory_lock($1, CAST(-2147483648 + $2::bigint AS integer))
LOG: (param:0) = 16185446
LOG: (param:1) = 2429776
LOG: (query) BEGIN ISOLATION LEVEL READ COMMITTED
LOG: (query) SET LOCAL statement_timeout = 100
LOG: (query) LOCK TABLE party IN ACCESS EXCLUSIVE MODE
LOG: (query) RESET statement_timeout
LOG: (query) SELECT pg_get_indexdef(indexrelid) FROM pg_index WHERE indrelid = $1 AND NOT indisvalid
LOG: (param:0) = 2429776
LOG: (query) SELECT indexrelid, repack.repack_indexdef(indexrelid, indrelid, $2, FALSE) FROM pg_index WHERE indrelid = $1 AND indisvalid
LOG: (param:0) = 2429776
LOG: (param:1) = (null)
ERROR: query failed: ERROR: unexpected index definition: CREATE UNIQUE INDEX party_pkey ON public.party USING btree (id) TABLESPACE pg_default
DETAIL: query was: SELECT indexrelid, repack.repack_indexdef(indexrelid, indrelid, $2, FALSE) FROM pg_index WHERE indrelid = $1 AND indisvalid
LOG: (query) SELECT repack.repack_drop($1, $2)
LOG: (param:0) = 2429776
LOG: (param:1) = 0
I can reproduce it every time with any table: always produces an `ERROR: unexpected index definition.
PostgreSQL 9.6.8 on x86_64-pc-linux-gnu (Debian 9.6.8-1.pgdg80+1), compiled by gcc (Debian 4.9.2-10+deb8u1) 4.9.2, 64-bit
pg_repack 1.4.2 installed via
sudo pip install pgxnclient
sudo apt-get install postgresql-server-dev-9.6
sudo pgxn install pg_repack
psql -c "CREATE EXTENSION pg_repack" -d lexdb
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 17 (5 by maintainers)
Could you please create a new tag containing this fix so that a new version can be added to http://apt.postgresql.org/pub/repos/apt/pool/main/p/pg-repack/ ?
Will a new release be created for this fix?
Thank you for the reporting! I’ve created a PR #172 to fix this problem.