| From: | "Koshi Shibagaki (Fujitsu)" <shibagaki(dot)koshi(at)fujitsu(dot)com> |
|---|---|
| To: | "'pgsql-hackers(at)lists(dot)postgresql(dot)org'" <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | [PATCH] reindexdb: Fix schema name lookup in parallel mode |
| Date: | 2026-10-13 13:07:00 |
| Message-ID: | TY5PR01MB1844509B94E3179A2A2434082FA9E2@TY5PR01MB18445.jpnprd01.prod.outlook.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
reindexdb currently interprets --schema differently with -j 2 than
without it.
For example, in a database testdb containing:
CREATE SCHEMA testschema;
CREATE TABLE testschema.t (id integer PRIMARY KEY);
these commands behave differently:
reindexdb -d testdb -S TESTSCHEMA
reindexdb -d testdb -S TESTSCHEMA -j 2
Without -j, TESTSCHEMA is folded to testschema and its index is reindexed.
With -j 2, the command succeeds without reindexing anything. The same
problem occurs with -S '"testschema"' (with double-quotes). Also, a nonexistent
schema causes an error in serial mode but is silently ignored in parallel mode.
Serial mode sends REINDEX SCHEMA to the server. Parallel mode instead
lists tables by comparing the supplied strings directly with
pg_namespace.nspname.
The attached v1 patch resolves schema names through regnamespace and
filters by namespace OID, as vacuumdb does. This handles case folding and
quoted names, and reports an error for a missing schema. Existing empty
schemas still succeed. TAP coverage checks case folding, quoted names,
and a missing schema specified alongside an empty one.
The regnamespace input syntax also differs from REINDEX SCHEMA: it accepts numeric
OIDs and '-', but does not recognize SQL comments or U&-quoted identifiers. vacuumdb
uses regnamaspace in both serial and parallel modes. Would this approach be acceptable for
reindexdb, or should its parallel mode follow REINDEX SCHEMA's input syntax more closely?
Feedback would be appreciated.
Koshi Shibagaki
FUJITSU LIMITED
https://www.fujitsu.com/
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Fix-schema-name-lookup-in-parallel-reindexdb.patch | application/octet-stream | 3.3 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Robert Haas | 2026-10-13 13:28:06 | Re: CREATE OR REPLACE MATERIALIZED VIEW |
| Previous Message | Alena Rybakina | 2026-10-13 13:02:46 | Re: Vacuum statistics |