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 1srcRG-003HHE-MQ for pgsql-hackers@arkaria.postgresql.org; Fri, 20 Sep 2024 12:08:43 +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 1srcRE-004mxC-N5 for pgsql-hackers@arkaria.postgresql.org; Fri, 20 Sep 2024 12:08:42 +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 1srcRD-004mwO-Nc for pgsql-hackers@lists.postgresql.org; Fri, 20 Sep 2024 12:08:41 +0000 Received: from fhigh5-smtp.messagingengine.com ([103.168.172.156]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1srcR6-000BEy-3f for pgsql-hackers@lists.postgresql.org; Fri, 20 Sep 2024 12:08:40 +0000 Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfhigh.phl.internal (Postfix) with ESMTP id 3D22F11400C7; Fri, 20 Sep 2024 08:08:31 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-09.internal (MEProxy); Fri, 20 Sep 2024 08:08:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1726834111; x= 1726920511; bh=Zxk8UKSwJ6gAmtPgPuT12vHamU9oTDJj0yDn8J+2l3U=; b=n DHkt4b7oxXVjmvIExGtTfnVhbmCEdCGl0qYJd17mwzMmgvVhHSvvuexQsi16q40h cbatr8x61ykwmzNkppQCxupLz7qjDYsnuNvvf65zfuxUqPNDXDf3LlkpMACpJvy1 85ejcVPXRDuzIWgE7uR/m/IdO0ukhpzHzJ+304TUIcjfw0x99Bx2yHQQx5zNHakN i/m9sQVpeCJ5IAFdxJmSRhu7JslK/XmlYzDgJYdgiyCtXM9/7/k8BEwzTHs6F+OP S41g3FcZaBCvWZ3eX3DarYNcdhYk2tMjysPERIrYYwL96zCdKx9i7Ptzy2EDO3VK ZwG/f5El5pOA5O6n2dMnA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudelfedggeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeen ucfhrhhomheptehlvhgrrhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhh drnhhoqdhiphdrohhrgheqnecuggftrfgrthhtvghrnhepvdektdffudfftdffffehfffh jeejhffgieeuueekjeekfffgudffhfduffffueevnecuffhomhgrihhnpegvnhhtvghrph hrihhsvggusgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgr ihhlfhhrohhmpegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgpdhnsggprh gtphhtthhopeefpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehjihgrnhdruhhn ihhvvghrshgrlhhithihsehgmhgrihhlrdgtohhmpdhrtghpthhtohepthhnughrfigrnh hgsehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrsheslhhi shhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 20 Sep 2024 08:08:30 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1726834108; bh=bPbq2KRCWtn/SE7YBjG6R1gN+Mq2hFJEgKhYgZnJcuk=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=hMpR9Grq+DFwuLww4nFKJ+D/usx9tlIXCP5otKa3I/F116P7C7rr18gsAEZ8uTwl2 xov4sW6VYajr8Y1Uf7TUxY6TcSq5TopryzOdFcGiiiLFNcj4amo3Nzr29RvBRg9WxF 9BLtbRkUrKb4FZgoAVu5Zajb7KcVxEJWhobty2+ARzpSdCMqcGbziU4EIMZix8QE3H Ndr/GaQG9J4LxCw051mpCTdN954kbh1Dr6bcaS4WMziKy0wBaBvVt0AFl1CCtVjB1t iAoninYHHp+eU8WapKdBRWWhVBp5i3Pq0oFonm2N/i5fg6Q2887PazYpLIyK5mRYDy im+QYni2JAUrg== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id 8FFF6B9; Fri, 20 Sep 2024 14:08:28 +0200 (CEST) Date: Fri, 20 Sep 2024 14:08:28 +0200 From: Alvaro Herrera To: jian he Cc: Tender Wang , Pg Hackers Subject: Re: not null constraints, again Message-ID: <202409201208.oktu73fuvffw@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2024-Sep-20, jian he wrote: > about set_attnotnull. > > we can make set_attnotnull look less recursive. > instead of calling find_inheritance_children, > let's just one pass, directly call find_all_inheritors > overall, I think it would be more intuitive. > > please check the attached refactored set_attnotnull. > regress test passed, i only test regress. Hmm, what do we gain from doing this change? It's longer in number of lines of code, and it's not clear to me that it is simpler. > I am also beginning to wonder if ATExecSetNotNull inside can also call > find_all_inheritors. The point of descending levels one by one in ATExecSetNotNull is that we can stop for any child on which a constraint already exists. We don't need to scan any children thereof, which saves work. -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/ "Use it up, wear it out, make it do, or do without"