Re: reindexdb: Change quoting rule of --schema?

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Alvaro Herrera <alvherre(at)kurilemu(dot)de>
Subject: Re: reindexdb: Change quoting rule of --schema?
Date: 2026-11-18 23:38:05
Message-ID: CAD21AoB7HYE3iYDAvhGWa3Cm=LKnbHV4V7AVLp_+otV0hKRhxQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Nov 14, 2026 at 10:34 AM Noah Misch <noah(at)leadboat(dot)com> wrote:
>
> On Sat, Nov 14, 2026 at 11:25:18AM +0900, Michael Paquier wrote:
> > reindexdb --schema has the idea of not quoting the schema given in
> > input of the command line. For example, if a schema uses upper-case
> > characters, the command could fail. Perhaps a fmtIdEnc() should be
> > applied, in the same fashion as --tablespace? This point has come
> > from Alvaro, during a recent review for a separate patch.
> >
> > Here is the suggested change:
> > case REINDEX_SCHEMA:
> > - appendPQExpBufferStr(sql, name);
> > + appendPQExpBufferStr(sql, fmtIdEnc(name, PQclientEncoding(conn)));
> >
> > There may be a point in treating that as a bug, but that's also a
> > backward-incompatible change so perhaps that could just be left as-is.
> > The new quoting behavior feels upgraded to me, though, but perhaps I'm
> > just biased.
>
> I think the change is mildly positive on balance. The rule would then be that
> possibly-schema-qualified options like --table need interior quoting, but
> single-name options don't. So a shell invocation would use
> --table='"Embedded""QuoteNSP"."T"' but would use
> --schema='Embedded"QuoteNSP'. I wouldn't back-patch it, though.

+1 for the change, master only.

The one downside is that passing an already-quoted name like -S
'"Foo"' stops working, but I think that's acceptable for master.

Regards,

--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joao Rito 2026-11-18 23:46:39 [PATCH] Add hint to wal_level errors for replication slots and pg_log_standby_snapshot
Previous Message Masahiko Sawada 2026-11-18 23:28:25 Re: Use an index scan in RemoveSubscriptionRel()