Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kv2wX-0004Ot-Ip for pgsql-docs@arkaria.postgresql.org; Thu, 31 Dec 2020 18:45:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kv2wW-0003vF-Gw for pgsql-docs@arkaria.postgresql.org; Thu, 31 Dec 2020 18:45:00 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kv2wW-0003v8-BD for pgsql-docs@lists.postgresql.org; Thu, 31 Dec 2020 18:45:00 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kv2wT-0006FT-Q1 for pgsql-docs@lists.postgresql.org; Thu, 31 Dec 2020 18:44:59 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1kv2wS-0002Nb-6B; Thu, 31 Dec 2020 13:44:56 -0500 Date: Thu, 31 Dec 2020 13:44:56 -0500 From: Bruce Momjian To: fotis.koutoupas@gmail.com, pgsql-docs@lists.postgresql.org Subject: Re: Potential typo in abbreviated insertion query Message-ID: <20201231184456.GG22199@momjian.us> References: <160912275508.676.17469511338925622905@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="H8ygTp4AXg6deix2" Content-Disposition: inline In-Reply-To: <160912275508.676.17469511338925622905@wrigleys.postgresql.org> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --H8ygTp4AXg6deix2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Dec 28, 2020 at 02:32:35AM +0000, PG Doc comments form wrote: > The following documentation comment has been logged on the website: > > Page: https://www.postgresql.org/docs/13/executor.html > Description: > > It's located within the parentheses of the last paragraph. > > >(A simple INSERT ... VALUES command creates a trivial plan tree consisting > of a single Result node, which computes just one result row, and ModifyTable > above it to perform the insertion. But INSERT ... SELECT can demand the full > power of the executor mechanism.) > > I'm under the impression that the second inline code block refers to `INSERT > ... VALUES`. I think the text is correct, but I also think it is trying to do too much in one paragraph. Here is a doc patch to improve this. -- Bruce Momjian https://momjian.us EnterpriseDB https://enterprisedb.com The usefulness of a cup is in its emptiness, Bruce Lee --H8ygTp4AXg6deix2 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="executor.diff" diff --git a/doc/src/sgml/arch-dev.sgml b/doc/src/sgml/arch-dev.sgml new file mode 100644 index 7883c3c..ade0ad9 *** a/doc/src/sgml/arch-dev.sgml --- b/doc/src/sgml/arch-dev.sgml *************** *** 529,554 **** ! The executor mechanism is used to evaluate all four basic SQL query types: ! SELECT, INSERT, UPDATE, and ! DELETE. For SELECT, the top-level executor ! code only needs to send each row returned by the query plan tree off ! to the client. For INSERT, each returned row is inserted ! into the target table specified for the INSERT. This is ! done in a special top-level plan node called ModifyTable. ! (A simple ! INSERT ... VALUES command creates a trivial plan tree ! consisting of a single Result node, which computes just one ! result row, and ModifyTable above it to perform the insertion. ! But INSERT ... SELECT can demand the full power ! of the executor mechanism.) For UPDATE, the planner arranges ! that each computed row includes all the updated column values, plus ! the TID (tuple ID, or row ID) of the original target row; ! this data is fed into a ModifyTable node, which uses the ! information to create a new updated row and mark the old row deleted. ! For DELETE, the only column that is actually returned by the ! plan is the TID, and the ModifyTable node simply uses the TID ! to visit each target row and mark it deleted. --- 529,564 ---- ! The executor mechanism is used to evaluate all four basic SQL query ! types: SELECT, INSERT, ! UPDATE, and DELETE. ! For SELECT, the top-level executor code ! only needs to send each row returned by the query plan tree ! off to the client. INSERT ... SELECT, ! UPDATE, and DELETE ! are effectively SELECTs under a special ! top-level plan node called ModifyTable. ! ! ! ! INSERT ... SELECT feeds the rows up ! to ModifyTable for insertion. For ! UPDATE, the planner arranges that each ! computed row includes all the updated column values, plus the ! TID (tuple ID, or row ID) of the original ! target row; this data is fed up to the ModifyTable ! node, which uses the information to create a new updated row and ! mark the old row deleted. For DELETE, the only ! column that is actually returned by the plan is the TID, and the ! ModifyTable node simply uses the TID to visit each ! target row and mark it deleted. ! ! ! ! A simple INSERT ... VALUES command creates a ! trivial plan tree consisting of a single Result ! node, which computes just one result row, feeding that up ! toModifyTable to perform the insertion. --H8ygTp4AXg6deix2--