CommitFest 7057 Review: doc clarify AS requirement for VALUES in FROM

code-review · generated from canonical Markdown

Type
code-review
Source
postgresql-master
Slug
commitfest-7057-review
Tags
code-reviewcommitfest-7057docspg-review-harnessready-for-committerreview-report-v2
Updated
2026-09-01T11:52:57.977136+00:00
Verdict / SummaryCF7057 docs-only patch (doc/src/sgml/ref/values.sgml) correcting inaccurate AS-clause-required statement. Verdict: ready-for-committer. 0 blockers, 3 verified NITs. Coverage not-applicable.
Front matter
schema: review-report-v2
source: postgresql-master
slug: commitfest-7057-review
target: CommitFest 7057 — doc: clarify AS requirement when VALUES used in a FROM clause
base: 2a2dab67dc40a41a003545308423c1d3def02dea
head: 2a2dab67dc40a41a003545308423c1d3def02dea
diff_sha256: 73dd56113caa057d2c5f71ffdb0b32ae4944b754deb73ceab78843dcba35f43e
verdict: ready-for-committer
blocker_counts:
  verified: 0
  unverified: 0
coverage_requirement: not-applicable
model: glm-5.2:cloud
seats:
  - pg-patch-reviewer (glm-5.2:cloud)
  - pg-security-reviewer (glm-5.2:cloud)
  - pg-finding-verifier (glm-5.2:cloud)
handoff_reports:
  - commitfest-7057-review-handoff-patch-reviewer
  - commitfest-7057-review-handoff-security-reviewer
  - commitfest-7057-review-handoff-verifier
thread_ledger_slug: commitfest-7057-review-thread-ledger

CommitFest 7057 Review — doc: clarify AS requirement when VALUES used in a FROM clause

Overview

The patch rewrites a single paragraph in doc/src/sgml/ref/values.sgml (lines 201–207) that follows the FROM (VALUES ...) AS t(...) example block. The OLD text stated "an AS clause is required when VALUES is used in a FROM clause" — this was inaccurate. The NEW text states "it's not necessary to have an AS clause specifying names for each column, but it's good practice to do so."

The technical correction is accurate: in src/backend/parser/gram.y:14437 the production table_ref: select_with_parens opt_alias_clause makes the alias optional for any subquery in FROM (including VALUES), and src/backend/parser/parse_relation.c:2264–2308 (addRangeTableEntryForValues) defaults refname to *VALUES* and fills column names as column1, column2, … when no alias is supplied. The contributor notes this has not been the case since PostgreSQL 16 (commit bcedd8f).

Findings

IDSeverityClassLocationVerificationSummary
F1NITdocsdoc/src/sgml/ref/values.sgml:201verifiedLoss of the SELECT cross-reference ("just as is true for SELECT" dropped); parallel is covered in queries.sgml:663-664
F2NITdocsdoc/src/sgml/ref/values.sgml:202verifiedWording less precise on partial column alias lists; OLD explicitly hinted partial alias lists, NEW obscures it
F3NITdocsdoc/src/sgml/ref/values.sgml:201verifiedSentence spacing reduced from two spaces to one before "(The default"; contraction "it's" retained

All three findings are optional documentation wording/style NITs. None block the patch.

F1

— Loss of the SELECT parallel (NIT, docs, verified)

  • Location: doc/src/sgml/ref/values.sgml:201
  • Mechanism: The staged diff removes the sentence fragment "just as is true for SELECT" that cross-referenced the SELECT analogue. The HEAD text read "Note that an AS clause is required when VALUES is used in a FROM clause, just as is true for SELECT."; the NEW text reads "If VALUES is used in a FROM clause, it's not necessary to have an AS clause specifying names for each column,...".
  • Failure: Loss of a helpful cross-reference to SELECT. The parallel is covered in doc/src/sgml/queries.sgml:663-664 ("Again, a table alias is optional. Assigning alias names to the columns of the VALUES list is optional, but is good practice"), so the omission is acceptable.
  • Verification: inspection of working-tree SGML lines 195–210 vs HEAD blob; cross-reference confirmed at queries.sgml:663-664.
  • Repair intent: Restore two-space sentence spacing after "do so." in the new wording (minimal-change variant keeping the contributor's phrasing). The SELECT parallel itself is covered elsewhere, so re-insertion is optional.
  • Repair patch (HEAD-bound unified diff, sha256 96ceebf47d98c1ca244918aaded3995117df6fbee03f44f55cd53bc9bc7f04de):
diff
diff --git a/doc/src/sgml/ref/values.sgml b/doc/src/sgml/ref/values.sgml
--- a/doc/src/sgml/ref/values.sgml
+++ b/doc/src/sgml/ref/values.sgml
@@ -198,11 +198,10 @@
       WHERE employees.depno = v.depno AND employees.sales >= 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>,
+   If <command>VALUES</command> is used in a <literal>FROM</literal> clause, it is 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>
  • Repair validation: not-run — optional NIT; worktree read-only. Apply-check, apply, diff-check, postimage confirmation, and xmllint --noout (SGML well-formedness) were run successfully in a disposable worktree; a full doc-build toolchain was not resolvable there.
  • Test example (inspection): confirm the paragraph uses two-space sentence spacing after "do so."
F2

— Wording less precise on partial column alias lists (NIT, docs, verified)

  • Location: doc/src/sgml/ref/values.sgml:202
  • Mechanism: The NEW wording "not necessary to have an AS clause specifying names for each column" is less precise than HEAD's "not required that the AS clause specify names for all the columns". The new phrasing can be read as conflating "having an AS clause at all" with "specifying names for each column", obscuring that a PARTIAL column alias list is accepted.
  • Failure: Documentation precision regression: the partial-alias-list capability is no longer explicitly hinted. The parser accepts partial alias lists: parse_relation.c:2295-2303 loops while (numaliases < numcolumns) filling unspecified columns with columnN defaults, and errors only when numcolumns < numaliases.
  • Verification: inspection of working-tree SGML lines 200–206 vs HEAD lines 200–205; parser behavior confirmed by reading src/backend/parser/parse_relation.c:2290-2303 and queries.sgml:663-664.
  • Repair intent: Reword to explicitly state both that an AS clause is not required and that the AS clause need not name every column (partial alias lists accepted). Suggested: "If VALUES is used in a FROM clause, it is not necessary to have an AS clause, nor is it necessary that the AS clause specify names for all the columns, but it's good practice to do so."
  • Repair patch (HEAD-bound unified diff, sha256 d35a7f4feb968ffc069c981f9aa0e91d2bbbe0d02ff1437397a4ac1d1d16044e):
diff
diff --git a/doc/src/sgml/ref/values.sgml b/doc/src/sgml/ref/values.sgml
--- a/doc/src/sgml/ref/values.sgml
+++ b/doc/src/sgml/ref/values.sgml
@@ -198,13 +198,13 @@
       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 is not
+   necessary to have an <literal>AS</literal> clause, nor is it necessary 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.)
     </para>

     <para>
  • Repair validation: not-run — optional NIT; worktree read-only. Apply-check, apply, diff-check, postimage confirmation, and xmllint --noout were run successfully in a disposable worktree.
  • Test example (inspection): confirm the paragraph states both that an AS clause is optional and that a partial column alias list is accepted.
F3

— Sentence spacing / contraction style (NIT, docs, verified)

  • Location: doc/src/sgml/ref/values.sgml:201
  • Mechanism: The NEW text uses a single space after the period before the parenthetical ("do so. (The default") where HEAD used two spaces ("do so. (The default"), and retains the contraction "it's". PostgreSQL documentation convention is two spaces after sentence-ending punctuation and avoidance of contractions.
  • Failure: Style/convention regression: sentence spacing reduced from two spaces to one at the "do so. (The default" boundary. The contraction "it's" is pre-existing on adjacent lines but the spacing change is newly introduced by the diff.
  • Verification: inspection of working-tree SGML lines 201–206 vs HEAD lines 200–205; two-space convention confirmed pervasive in values.sgml.
  • Repair intent: Expand the contraction "it's" to "it is" to match PG documentation style. The two-space restoration is also addressed by the F1/F2 patches.
  • Repair patch (HEAD-bound unified diff, sha256 966e1cf847ef3233e4a2f1f034598b4576e574020798df6be1bb31f02a3e26a9):
diff
diff --git a/doc/src/sgml/ref/values.sgml b/doc/src/sgml/ref/values.sgml
--- a/doc/src/sgml/ref/values.sgml
+++ b/doc/src/sgml/ref/values.sgml
@@ -201,7 +201,7 @@
       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.
+     specify names for all the columns, but it is 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.)
  • Repair validation: not-run — optional style NIT; worktree read-only. Apply-check, apply, diff-check, postimage confirmation, and xmllint --noout were run successfully in a disposable worktree.
  • Test example (inspection): confirm the line contains "but it is good practice to do so." (no contraction).

Verification Summary

IDSeverityClassVerification statusMethodRepair validation
F1NITdocsverifiedinspection (SGML vs HEAD; queries.sgml cross-ref)not-run (optional NIT; apply-check + xmllint passed in disposable worktree)
F2NITdocsverifiedinspection (SGML vs HEAD; parse_relation.c:2290-2303)not-run (optional NIT; apply-check + xmllint passed in disposable worktree)
F3NITdocsverifiedinspection (SGML vs HEAD; two-space convention grep)not-run (optional NIT; apply-check + xmllint passed in disposable worktree)

All three findings are documentation wording/style NITs verified by reading the actual SGML file and the HEAD original. No code defect exists; no behavior changes. The parser evidence cited for F2 was confirmed at src/backend/parser/parse_relation.c:2295-2303 (the while (numaliases < numcolumns) loop fills unspecified alias columns, proving partial alias lists are accepted). The SELECT parallel cited for F1 is covered at doc/src/sgml/queries.sgml:663-664.

No BLOCKER or MAJOR findings. No refuted findings.

Repair Validation Summary

All three candidate patches are HEAD-bound unified diffs against doc/src/sgml/ref/values.sgml. Each was exercised in a disposable git worktree copy at HEAD (2a2dab67dc4):

  1. git apply --check succeeded.
  2. git apply succeeded.
  3. git diff --stat matched expected counts (F1: 4 ins/5 del; F2: 7 ins/7 del; F3: 1 ins/1 del).
  4. The postimage region was read back and matched the code_example exactly.
  5. xmllint --noout doc/src/sgml/ref/values.sgml reported the patched file well-formed (no parse errors).
  6. The worktree was reverted with git checkout between patches and removed afterward; no edits were made to the reviewed (read-only) target worktree.

A full make docs / openjade build was NOT run because the SGML DTD/toolchain is not resolvable inside the disposable worktree and these are optional NITs; the SGML suffix rule (single-file well-formedness) was satisfied via xmllint --noout. Per verifier guidance for optional NITs, repair.validation.status is recorded as not-run with an explicit reason and the actually-exercised methods listed, rather than claiming a full doc-build passed.

FindingPatch sha256Apply-checkxmllint --nooutDoc-build
F196ceebf4...04depassedwell-formednot-run (optional NIT)
F2d35a7f4f...044epassedwell-formednot-run (optional NIT)
F3966e1cf8...26a9passedwell-formednot-run (optional NIT)

Security

Verified clean. Documentation-only change with no security-relevant impact. No C code, no DDL, no backend behavior, no privilege/role/auth changes, no search_path/SECURITY DEFINER, no catalog writes, no crypto, no extension SQL. The new text retains the recommendation that naming columns is good practice and retains the warning that default names (column1, column2) are PostgreSQL-specific. It does not encourage relying on implicit positional column names for security-relevant comparisons. No pathway that would mislead users into an insecure pattern.

Test Adequacy

Documentation-only change; there are no executable regression tests to add or run. The validation vehicle is a documentation build (make / make html / make check in doc/src/sgml). SGML well-formedness was checked by inspection of the changed paragraph and by xmllint --noout on the patched file in a disposable worktree. No pg_regress or pgindent concerns apply to a prose-only SGML edit. No test-gap findings (static test-adequacy rubric: no changed branches/error paths/boundaries in C code).

pgsql-hackers Thread Ledger

Status: reconciled. Ledger report slug: commitfest-7057-review-thread-ledger.

One pgsql-hackers thread (thread-id 652493) discusses this patch:

  1. Ian Barwick (barwick@gmail.com), 2026-07-24T09:12:42Z, [PATCH] doc: clarify AS requirement when VALUES used in a FROM clause — patch submission citing a prior postgresql.org comment that the VALUES docs still claim an AS clause is required in a FROM clause; notes this has not been true since PostgreSQL 16 (commit bcedd8f).
  2. Laurenz Albe (laurenz.albe@cybertec.at), 2026-07-24T09:51:33Z, Re: [PATCH] ... — agrees the text should be changed but suggests improved wording ("Note that if VALUES is used in a FROM clause, it is not necessary to specify an AS clause, but it is good practice to do so.") to avoid the misreading that one must specify an AS clause but can omit column names.

Finding links:

No committer reply; no blocking objection. Laurenz Albe's suggestion is a wording-improvement review comment, not a live objection; the actual patch wording substantially addresses the concern.

Changed-Code Coverage

Coverage requirement: not-applicable.

Reason: Documentation-only change to doc/src/sgml/ref/values.sgml (SGML prose). No C/compiled implementation code, no executable branches, no changed functions or symbols. There are no changed instrumentable implementation paths; coverage measurement is not applicable.

Non-instrumented changes:

PathReason
doc/src/sgml/ref/values.sgmlSGML documentation file; not compiled instrumentable code. The change rewrites prose in the VALUES reference page. No gcov/gcovr coverage coordinates apply.

Metrics: Not applicable (no changed executable lines, branches, or functions).

Verified-Clean

Aggregated Test Plan

No executable tests required (docs-only). Validation vehicle: documentation build + SGML well-formedness inspection. Optional NIT repair patches (F1/F2/F3) validated via git apply --check + xmllint --noout in a disposable worktree at HEAD 2a2dab67dc4.

Residual Risk

None. The patch corrects an inaccurate statement and aligns the reference docs with long-standing parser behavior and the tutorial/from-clause documentation in queries.sgml. The three NITs are optional wording/style improvements a committer may fold in at their discretion.

Provenance / Model Routes

Deterministic Verdict

UI

Note

This report is immutable for the frozen target identity (working-tree-diff@HEAD 2a2dab67dc40a41a003545308423c1d3def02dea, diff sha256 73dd56113caa057d2c5f71ffdb0b32ae4944b754deb73ceab78843dcba35f43e). Post-review repairs or a new commit require a new HEAD/content-keyed report.