| From: | "Koshi Shibagaki (Fujitsu)" <shibagaki(dot)koshi(at)fujitsu(dot)com> |
|---|---|
| To: | Takeshi Ideriha <iderihatakeshi(at)gmail(dot)com>, "'pgsql-hackers(at)lists(dot)postgresql(dot)org'" <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: [PATCH] reindexdb: Fix schema name lookup in parallel mode |
| Date: | 2026-10-23 03:04:38 |
| Message-ID: | TY5PR01MB18445C599BE4C1491BBA2DED9FA642@TY5PR01MB18445.jpnprd01.prod.outlook.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
Thanks for reviewing the patch.
I agree with your comment that accepting numeric OIDs and '-' is reasonable here,
given the vacuumdb precedent. I'll keep the regnamespace approach.
Regards,
Koshi Shibagaki
FUJITSU LIMITED
https://www.fujitsu.com/
________________________________________
差出人: Takeshi Ideriha <iderihatakeshi(at)gmail(dot)com>
送信日時: 2026年10月21日 15:52
宛先: Shibagaki, Koshi/柴垣 向志; 'pgsql-hackers(at)lists(dot)postgresql(dot)org'
件名: Re: [PATCH] reindexdb: Fix schema name lookup in parallel mode
Hi,
On 2026/10/13 22:07, Koshi Shibagaki (Fujitsu) wrote:
> 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?
+1 for using regnamespace. The fix looks good to me.
I believe accepting schema OID and '-' is not harmful. '-' just matches
nothing and nothing happens. Vacuumdb and the vacuum command have
different syntax. Vacuumdb also accepts numeric schema OIDs but the
vacuum command does not even have a schema option. Even if there is a
schema named "16384", we need to specify it as -S '"16384"' regardless
of the -j option for the new reindexdb.
Regards,
Takeshi Ideriha
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Daniel Gustafsson | 2026-10-23 03:27:35 | Re: [PATCH] Keep git-external-diff usage text from executing |
| Previous Message | Chao Li | 2026-10-23 02:23:29 | Re: Publication of same parent table with ONLY-ness mismatch should error |