Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eK4a8-0005XL-QT for pgsql-hackers@arkaria.postgresql.org; Wed, 29 Nov 2017 15:47:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eK4a8-0002tX-2L for pgsql-hackers@arkaria.postgresql.org; Wed, 29 Nov 2017 15:47:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eK4a7-0002tN-Rz for pgsql-hackers@lists.postgresql.org; Wed, 29 Nov 2017 15:47:27 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eK4a4-0004Wa-UR for pgsql-hackers@postgresql.org; Wed, 29 Nov 2017 15:47:27 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id vATFlLnA009879; Wed, 29 Nov 2017 10:47:21 -0500 From: Tom Lane To: Stephen Frost cc: Robert Haas , Sergei Kornilov , "pgsql-hackers@postgresql.org" Subject: Re: using index or check in ALTER TABLE SET NOT NULL In-reply-to: <20171129152135.GN4628@tamriel.snowman.net> References: <81911511895540@web58j.yandex.ru> <20171129152135.GN4628@tamriel.snowman.net> Comments: In-reply-to Stephen Frost message dated "Wed, 29 Nov 2017 10:21:35 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <9877.1511970441.1@sss.pgh.pa.us> Date: Wed, 29 Nov 2017 10:47:21 -0500 Message-ID: <9878.1511970441@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Stephen Frost writes: > Isn't the first concern addressed by using SPI..? I did not look at the patch yet, but TBH if it uses SPI for sub-operations of ALTER TABLE I think that is sufficient reason to reject it out of hand. Doing things that way would create way too much of a vulnerability surface for code touching a partially-updated table. At minimum, we'd have to blow holes in existing protections like CheckTableNotInUse, and I think we'd be forever finding other stuff that failed to work quite right in that context. I do not want ALTER TABLE going anywhere near the planner or executor; I'm not even happy that it uses the parser (for index definition reconstruction). regards, tom lane