Re: [PATCH] doc: clarify AS requirement when VALUES used in a FROM clause

From: Ian Lawrence Barwick <barwick(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] doc: clarify AS requirement when VALUES used in a FROM clause
Date: 2026-08-21 10:06:21
Message-ID: CAB8KJ=g4bEjKroocPEZ1G4xHwWWRnMPdqBzk56LTj08eAODs9g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2026年8月21日(金) 16:15 Ian Lawrence Barwick <barwick(at)gmail(dot)com>:
>
> 2026年8月21日(金) 16:01 Fujii Masao <masao(dot)fujii(at)gmail(dot)com>:
> >
> > On Fri, Aug 21, 2026 at 2:48 PM Ian Lawrence Barwick <barwick(at)gmail(dot)com> wrote:
> > > True, but that omits the point the original documentation is making,
> > > i.e. that an
> > > AS clause should preferably specify names for all columns, so:
> > >
> > > Note that if <command>VALUES</command> is used in a
> > > <literal>FROM</literal> clause,
> > > it is not necessary to provide an <literal>AS</literal> clause, but
> > > it's good practice
> > > to do so and specify names for each column.
> > >
> > > I.e. don't do something like SELECT * FROM (values (1,2)) AS f(foo).
> >
> > Thanks for updating the patch!
> >
> > + <command>VALUES</command> are
> > <literal>column1</literal>,<literal>column2</literal>,
> >
> > A space should be added just after "<literal>column1</literal>,".
> >
> >
> > + Note that if <command>VALUES</command> is used in a
> > <literal>FROM</literal> clause,
> > + it is not necessary to provide an <literal>AS</literal> clause,
> > but it's good practice
> > + to do so and specify names for each column. (The default column names for
> >
> > Even when an alias is supplied, the AS keyword itself is optional, e.g.
> > FROM (VALUES (1, 2)) v(a, b). So I think it's better to avoid saying
> > "AS clause" here. Instead, how about using wording similar to queries.sgml,
> > as follows?
> >
> > Note that if <command>VALUES</command> is used in a <literal>FROM</literal>
> > clause, a table alias is optional. Assigning alias names to the columns
> > of the <command>VALUES</command> list is optional, but is good practice.
>
> Oh yes, that sounds much better!

Revised patch attached.

Regards

Ian Barwick

Attachment Content-Type Size
v3-0001-doc-clarify-AS-requirement-when-VALUES-used-in-a-.patch text/x-patch 1.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rafia Sabih 2026-08-21 10:25:50 Re: Bypassing cursors in postgres_fdw to enable parallel plans
Previous Message Etsuro Fujita 2026-08-21 10:04:39 Re: Further cleanup related to statistics import support in postgres_fdw