Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tUzLQ-004Qwb-1S for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Jan 2025 02:29:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tUzLP-00G1Oy-EI for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Jan 2025 02:29:23 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tUzLP-00G1Oo-4T for pgsql-hackers@lists.postgresql.org; Tue, 07 Jan 2025 02:29:22 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tUzLK-000Ggt-2H for pgsql-hackers@lists.postgresql.org; Tue, 07 Jan 2025 02:29:22 +0000 Received: from oss.nttdata.com (localhost [127.0.0.1]) by oss.nttdata.com (Postfix) with ESMTPA id C66F460172; Tue, 7 Jan 2025 11:29:12 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at oss.nttdata.com MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Tue, 07 Jan 2025 11:29:12 +0900 From: Masahiro Ikeda To: Robert Treat Cc: pgsql-hackers@lists.postgresql.org Subject: Re: Doc: fix the rewrite condition when executing ALTER TABLE ADD COLUMN In-Reply-To: References: <00e6eb5f5c793b8ef722252c7a519c9a@oss.nttdata.com> <6ec15608e2c05d8d2a51de3d51a87312@oss.nttdata.com> User-Agent: Roundcube Webmail/1.4.11 Message-ID: X-Sender: ikedamsh@oss.nttdata.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2025-01-07 06:27, Robert Treat wrote: > On Mon, Jan 6, 2025 at 3:18 AM Masahiro Ikeda > wrote: >> >> On 2025-01-03 01:25, Robert Treat wrote: >> > On Tue, Dec 3, 2024 at 3:13 AM Masahiro Ikeda >> > wrote: >> >> >> >> Hi, >> >> >> >> The documentation seems to overlook the rewrite condition >> >> when executing ALTER TABLE ADD COLUMN. >> >> >> >> The current document states that a volatile DEFAULT will >> >> trigger a rewrite of the table and its indexes. However, the >> >> table and its indexes will also be rewritten when an IDENTITY >> >> column is added, or when a column with a domain data type that >> >> has constraints is added. >> >> >> >> What do you think? >> >> >> > >> > We still see a number of people asking (or confused) about table >> > rewrites when adding columns, so I think the initial tip should >> > remain, though I think it can be cleaned up a little. >> > >> > In the second section (alter_table.sgml) I liked the idea of adding >> > these additional examples, though I tweaked the wording a bit to >> > (hopefully) make it a little easier to read. >> > >> > Modified patch attached. >> >> Thanks! It looks good to me with one minor comment. >> >> Is the following intended to remove "However"? It seems that we don't >> need to modify the lines if the initial tip remains. >> >> >> - However, if the default value is volatile (e.g., >> - clock_timestamp()) >> + If the default value is volatile (e.g., >> clock_timestamp()) >> each row will need to be updated with the value calculated at >> the >> time >> > > Technically speaking, because we split the tip into two distinct > paragraphs, use of the word however would be considered poor grammar, > though I'll admit I only removed it because it felt superfluous. OK, thanks for your comments. Regards, -- Masahiro Ikeda NTT DATA CORPORATION