Re: Should the WAIT FOR command tag be "WAIT" or "WAIT FOR"?

From: Xuneng Zhou <xunengzhou(at)gmail(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Alexander Korotkov <aekorotkov(at)gmail(dot)com>, Ivan Kartyshov <i(dot)kartyshov(at)postgrespro(dot)ru>
Subject: Re: Should the WAIT FOR command tag be "WAIT" or "WAIT FOR"?
Date: 2026-08-31 04:52:22
Message-ID: CABPTF7XycL6ka5EikrvN8eCPDcFc_ADK-ePx=vkvv82ubdDBUQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Sawada-san, Tom,

On Sat, Aug 29, 2026 at 5:40 AM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
>
> On Fri, Aug 28, 2026 at 1:11 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >
> > Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> writes:
> > > While reviewing a patch for the WAIT FOR command I noticed that its
> > > command tag is "WAIT" rather than "WAIT FOR". I could not find this
> > > discussed in the main thread, although I have not read all of them, so
> > > I might miss something. I want to confirm it because a command tag is
> > > not something we can revisit later when we release v19.0.
> >
> > I think it's fine. The FOR is a noise word that's useful only to
> > make the command's grammar vaguely resemble English. For precedent,
> > consider INSERT, which must have INTO but that's not part of the
> > command tag.
>
> Good point. A difference between INSERT and WAIT is that the doc uses
> "WAIT FOR" as its command name instead of "WAIT" whereas it uses
> "INSERT" for INSERT statements:
>
> % git grep -e "<command>WAIT.*</command>"
> doc/src/sgml/ref/wait_for.sgml: <command>WAIT FOR</command> must be
> executed as a top-level command.
> doc/src/sgml/ref/wait_for.sgml: <command>WAIT FOR</command> waits
> until the specified
> doc/src/sgml/ref/wait_for.sgml: <command>WAIT FOR</command> compares
> only the numeric
> doc/src/sgml/ref/wait_for.sgml: <command>WAIT FOR</command> will
> return <literal>success</literal>
> doc/src/sgml/ref/wait_for.sgml: On a standby server, <command>WAIT
> FOR</command> sessions may be
> doc/src/sgml/ref/wait_for.sgml: doing. Applications using
> <command>WAIT FOR</command> on a standby
> doc/src/sgml/ref/wait_for.sgml: You can use <command>WAIT
> FOR</command> command to wait for
> doc/src/sgml/ref/wait_for.sgml: Then an application could run
> <command>WAIT FOR</command>
> doc/src/sgml/ref/wait_for.sgml: The same example uses <command>WAIT
> FOR</command> with
> doc/src/sgml/release-19.sgml: A new <link
> linkend="sql-wait-for"><command>WAIT FOR</command></link>
> doc/src/sgml/release-19.sgml:Add <link
> linkend="sql-wait-for"><command>WAIT FOR</command></link> command to
> allow standbys to wait for <link
> linkend="wal-internals"><acronym>LSN</acronym></link> values to be
> written, flushed, or replayed (Kartyshov Ivan, Alexander Korotkov,
> Xuneng Zhou)
>
> >
> > > Strictly the same rule would argue for
> > > "WAIT FOR LSN", but "WAIT FOR" is the name the manual gives the
> > > command, and it leaves room if other things become waitable in the
> > > future.
> >
> > If anything, I'd change the manual. "WAIT FOR" is neither short
> > nor a useful description of what's being waited for. Either "WAIT"
> > or "WAIT FOR LSN" would be more plausible as a page heading.
>
> Agreed.

Thanks for raising this. The above reasoning makes sense to me. Here's
a patch for it.

--
Regards,
Xuneng Zhou
HighGo Software Co., Ltd.

Attachment Content-Type Size
v1-0001-doc-Rename-the-WAIT-FOR-reference-page-to-WAIT.patch application/octet-stream 1.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2026-08-31 04:55:28 Re: pg_*_advice: tsv load failure, etc.
Previous Message Suraj Kharage 2026-08-31 04:49:27 Re: [PATCH] Add support for INSERT ... SET syntax