pg.ddx.io  reorg/pg_repack GitHub issues and pull requests  
help / color / mirror / Atom feed
[reorg/pg_repack] issue #468: Index not exist with exit code = 0
2+ messages / 2 participants
[nested] [flat]

* [reorg/pg_repack] issue #468: Index not exist with exit code = 0
@ 2025-10-16 07:46  "Soni-Harriz (@Soni-Harriz)" <noreply+Soni-Harriz@github.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Soni-Harriz (@Soni-Harriz) @ 2025-10-16 07:46 UTC (permalink / raw)
  To: reorg/pg_repack <noreply+reorg-pg_repack@github.com>

Hello, we found issue here
Ubuntu 24.04.1 LTS
PG 17.5 (Ubuntu 17.5-1.pgdg24.04+1)
pg_repack 1.5.2

Whenever we try to repack an index that does not exist, the repack exit code is 0.

pg_repack -U username -h localhost --index='public.my_index_not_exist' --wait-timeout=3600 dbname
WARNING: ERROR:  relation "public.my_index_not_exist" does not exist
CONTEXT:  unnamed portal parameter $1 = '...'
echo $?
0

^ permalink  raw  [nested|flat] 2+ messages in thread

* Re: [reorg/pg_repack] issue #468: Index not exist with exit code = 0
@ 2026-10-30 12:33  "jack5505 (@jack5505)" <noreply+jack5505@github.com>
  0 siblings, 0 replies; 2+ messages in thread

From: jack5505 (@jack5505) @ 2026-10-30 12:33 UTC (permalink / raw)
  To: reorg/pg_repack <noreply+reorg-pg_repack@github.com>

Hi! I'd like to take this one if nobody is working on it yet.

What I see in the code: in `repack_all_indexes()` the failure paths (query error, no rows returned for the given index, `repack_table_indexes()` returning false) log a WARNING and `continue`, but the function still returns true at the end, so `main()` never reports an error and the exit code stays 0.

Proposed fix:
- track a failure flag inside the loop in `repack_all_indexes()` and return false if any requested index could not be processed, so the program exits non-zero;
- additionally validate `--index` arguments up front, similar to what `is_requested_relation_exists()` already does for `--table` / `--parent-table`, so a typo fails fast before any work is done;
- add a regression test for a non-existent index passed via `--index`.

One question before I start: when several `--index` arguments are given and one of them does not exist, should pg_repack abort immediately (consistent with `--table`), or process the valid ones and exit non-zero at the end? I lean towards failing fast, but happy to follow your preference.

^ permalink  raw  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-10-30 12:33 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-10-16 07:46 [reorg/pg_repack] issue #468: Index not exist with exit code = 0 "Soni-Harriz (@Soni-Harriz)" <noreply+Soni-Harriz@github.com>
2026-10-30 12:33 Re: [reorg/pg_repack] issue #468: Index not exist with exit code = 0 "jack5505 (@jack5505)" <noreply+jack5505@github.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox