From 4aa640a395cab42012fd26570dafca1001a6debd Mon Sep 17 00:00:00 2001 From: Fujii Masao Date: Tue, 1 Sep 2026 22:46:10 +0900 Subject: [PATCH] doc: clarify aliasing of VALUES in FROM clauses The VALUES reference page said that an AS clause was required when VALUES is used in a FROM clause. This was imprecise because AS is optional when specifying an alias. In v14 and v15, a table alias is still required in this case, so state that explicitly instead. In v16 and later, commit bcedd8f5fce made table aliases for subqueries in FROM clauses optional, so state that the table alias is optional there. In all branches, continue to recommend explicit column aliases as good practice. Backpatch to all supported versions. Author: Ian Barwick Reviewed-by: Laurenz Albe Reviewed-by: Fujii Masao Discussion: https://postgr.es/m/CAB8KJ=jrvZdNLLhYSiCgbjLTz2LKEjYw+-HVQkaF+kgk61KtHA@mail.gmail.com Backpatch-through: 14 --- doc/src/sgml/ref/values.sgml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/src/sgml/ref/values.sgml b/doc/src/sgml/ref/values.sgml index 4bf7bfdffee..8536d065aad 100644 --- a/doc/src/sgml/ref/values.sgml +++ b/doc/src/sgml/ref/values.sgml @@ -198,10 +198,9 @@ UPDATE employees SET salary = salary * v.increase WHERE employees.depno = v.depno AND employees.sales >= v.target; - 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. + Note that if VALUES is used in a FROM + clause, a table alias is optional. Assigning alias names to the columns + of the VALUES list is optional, but is good practice. (The default column names for VALUES are column1, column2, etc. in PostgreSQL, but these names might be different in other database systems.)