pg.ddx.io  reorg/pg_repack GitHub issues and pull requests  
help / color / mirror / Atom feed
From: jack5505 (@jack5505) <noreply+jack5505@github.com>
To: reorg/pg_repack <noreply+reorg-pg_repack@github.com>
Subject: Re: [reorg/pg_repack] issue #468: Index not exist with exit code = 0
Date: Fri, 30 Oct 2026 12:33:13 +0000
Message-ID: <gh-reorg-pg_repack-468-c6522940904@github.com> (raw)
In-Reply-To: <gh-reorg-pg_repack-468@github.com>
References: <gh-reorg-pg_repack-468@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.

view thread (2+ messages)

Message-ID: <gh-reorg-pg_repack-468-c6522940904@github.com>
Permalink:  ../gh-reorg-pg_repack-468-c6522940904@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