Hi

Per comment here:

  
https://www.postgresql.org/message-id/178484951486.1225.14869692065642101159%40wrigleys.postgresql.org

the VALUES documentation [*] still claims an AS clause is required
when VALUES is
used in a FROM clause. This has not been the case since PostgreSQL 16
(commit bcedd8f).

[*] https://www.postgresql.org/docs/current/sql-values.html

Attached patch reworks the offending sentence from:

> Note that an AS clause is required when VALUES is used in a FROM clause, just
> as is true for SELECT. It is not required that the AS clause specify names for
> all the columns, but it's good practice to do so.

to:

> If VALUES is used in a FROM clause, it's not necessary to have an AS clause
> specifying names for each column, but it's good practice to do so.

Regards

Ian Barwick
From a7f91fcb2e0eeadc93a9f9ce0acaa82eb5096144 Mon Sep 17 00:00:00 2001
From: Ian Barwick <[email protected]>
Date: Fri, 24 Jul 2026 18:02:50 +0900
Subject: [PATCH v1] doc: clarify AS requirement when VALUES used in a FROM
 clause

From PostgreSQL 16 (commit bcedd8f), subquery aliases in the FROM clause
are optional, so update the VALUES reference documentation to reflect
this.
---
 doc/src/sgml/ref/values.sgml | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/doc/src/sgml/ref/values.sgml b/doc/src/sgml/ref/values.sgml
index 4bf7bfdffee..dab12ef7935 100644
--- a/doc/src/sgml/ref/values.sgml
+++ b/doc/src/sgml/ref/values.sgml
@@ -198,13 +198,12 @@ UPDATE employees SET salary = salary * v.increase
   WHERE employees.depno = v.depno AND employees.sales &gt;= v.target;
 </programlisting>
 
-   Note that an <literal>AS</literal> clause is required when <command>VALUES</command>
-   is used in a <literal>FROM</literal> clause, just as is true for
-   <command>SELECT</command>.  It is not required that the <literal>AS</literal> clause
-   specify names for all the columns, but it's good practice to do so.
-   (The default column names for <command>VALUES</command> are <literal>column1</literal>,
-   <literal>column2</literal>, etc. in <productname>PostgreSQL</productname>, but
-   these names might be different in other database systems.)
+   If <command>VALUES</command> is used in a <literal>FROM</literal> clause, it's not
+   necessary to have an <literal>AS</literal> clause specifying names for each column,
+   but it's good practice to do so. (The default column names for <command>VALUES</command>
+   are <literal>column1</literal>, <literal>column2</literal>, etc. in
+   <productname>PostgreSQL</productname>, but these names might be different in other
+   database systems.)
   </para>
 
   <para>
-- 
2.43.0

Reply via email to