commit 3ae125aafb5bad062952be1e9f97cb2288350f5b Author: David G. Johnston Date: Tue Apr 12 02:51:18 2022 +0000 doc: For INSERT ON CONFLICT excluded is a only a name, not a table. As one cannot place excluded in a FROM clause (subquery) in the ON CONFLICT clause referring to it as a table, with plural rows nonetheless, leads the reader to infer more about what the behavior here is than is correct. We already just say use the table's name for the existing row so just match that pattern of using the name excluded for the proposed row. The alias description doesn't have the same issue regarding the use of the word table and rows, as the use there is more conceptual, but the wording about "otherwise taken as" is wrong: rather two labels of excluded end up in scope and you get an ambigious name error. The error messages still consider excluded to be a table reference and this patch does not try to change that. That implementation detail need not force the user-facing documentation for the feature to use the term table when it doesn't really apply. diff --git a/doc/src/sgml/ref/insert.sgml b/doc/src/sgml/ref/insert.sgml index a9af9959c0..0fad1d3640 100644 --- a/doc/src/sgml/ref/insert.sgml +++ b/doc/src/sgml/ref/insert.sgml @@ -175,9 +175,8 @@ INSERT INTO table_name [ AS table_name. When an alias is provided, it completely hides the actual name of the table. This is particularly useful when ON CONFLICT DO UPDATE - targets a table named excluded, since that will otherwise - be taken as the name of the special table representing rows proposed - for insertion. + targets a table named excluded, since that will + conflict with the special name representing the row proposed for insertion. @@ -396,8 +395,8 @@ INSERT INTO table_name [ AS SET and WHERE clauses in ON CONFLICT DO UPDATE have access to the existing row using the - table's name (or an alias), and to rows proposed for insertion - using the special excluded table. + table's name (or an alias), and to the proposed row + using the name excluded. SELECT privilege is required on any column in the target table where corresponding excluded columns are read. @@ -699,8 +698,8 @@ INSERT INTO employees_log SELECT *, current_timestamp FROM upd; Insert or update new distributors as appropriate. Assumes a unique index has been defined that constrains values appearing in the - did column. Note that the special - excluded table is used to reference values originally + did column. Note that the name + excluded is used to reference values originally proposed for insertion: INSERT INTO distributors (did, dname)