pg.ddx.io  reorg/pg_repack GitHub issues and pull requests  
help / color / mirror / Atom feed
From: ritojoao (@ritojoao) <noreply+ritojoao@github.com>
To: reorg/pg_repack <noreply+reorg-pg_repack@github.com>
Subject: Re: [reorg/pg_repack] PR #493: Use format() and pg_catalog-qualified catalog tables in pg_repack.sql.in
Date: Thu, 12 Nov 2026 11:01:12 +0000
Message-ID: <gh-reorg-pg_repack-493-c6821782444@github.com> (raw)
In-Reply-To: <gh-reorg-pg_repack-493@github.com>
References: <gh-reorg-pg_repack-493@github.com>

Thank you, @CyberDem0n, that is a good point, and I tested it.

I created `public.format(text, text)` (and a few overloads, also in a second schema for setup B) that return a marker string, then ran the helpers and the real `pg_repack` client against a table, on PostgreSQL 18. I tried three setups: the fake function created after `CREATE EXTENSION` with two different search_path orders (A and B), and the fake function created before `CREATE EXTENSION pg_repack` (C).

- Before this PR: the fake `format()` was picked in all three setups, and the generated SQL was changed.
- With the first two commits (`SET search_path = pg_catalog, pg_temp` on the functions): A and B were clean. C was still affected, because the view `repack.tables` has no search_path of its own and binds `format()` when the extension is created. In that setup the client sent the fake SQL, the lock step failed with a syntax error, and the table was not repacked (no swap happened).
- I pushed a third commit that writes `pg_catalog.format()` in the `repack.tables` view, plus `pg_catalog.current_database()`, `pg_catalog.min()` in `repack.primary_keys`, and `pg_catalog.current_setting()` in the `DO` block. With it, A, B and C show no `format()` shadowing in my test, and the client repacks the table in B and C. `make installcheck` passes (13 tests).

Not covered: operators in the view (`=`, `LIKE`) are still resolved through search_path, and I only tested PostgreSQL 18 with a simple table.

A side note from the same test: in setup C the client printed a WARNING and still exited with code 0, because a failed lock in `repack_one_table()` goes to cleanup without changing the exit code. That is outside this PR, but I can open a separate issue if it is useful.


view thread (21+ messages)  latest in thread

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