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
