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 1r0mkC-007p3t-5c for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Nov 2023 17:53:36 +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 1r0mkA-006a8b-Pj for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Nov 2023 17:53:34 +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 1r0mkA-006a8S-Dz for pgsql-hackers@lists.postgresql.org; Wed, 08 Nov 2023 17:53:34 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r0mk7-005OEG-QG for pgsql-hackers@lists.postgresql.org; Wed, 08 Nov 2023 17:53:33 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 34FE05C00DF; Wed, 8 Nov 2023 12:53:30 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Wed, 08 Nov 2023 12:53:30 -0500 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:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1699466010; x= 1699552410; bh=LFi+A5ZFVmFI3SqlFXC5oVVCUBM8zV34EcJ0/HSqfEM=; b=f NI9QXr/0rfTdcmJ3YHMnBBhzypmCb295RgBxFKcfd1WuxMedGGmfi8xFKAdBBzfO 5d92FghgFg4xbp855bj6aZIkulUXkr7NjJaaY+3f3UwDlk8RRIA+0dAXQdUEAAII 0o0DDexvmbERRglPos7+DAR8ZHyqqXR6Uh/TqVQPeR6PbpS3i6DQGfCkrhOBBO4L 4ZCXDEmiW/tg+AeHiWfStOB2YN3/t4UZ2WQJpd1G9tpHEcQpvq4S+apciivXKwd3 iW35sOBIg30s5jHfKTZHNsMvSLd0yWQwRyjMKpc4kNzPZ23MBorhxwpG4r/WQf6+ w+Vwe0e3rHioKH/N7NX2Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudduledguddtgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetlhhv rghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorh hgqeenucggtffrrghtthgvrhhnpedvkedtffduffdtffffheffhfejjefhgfeiueeukeej keffgfdufffhudffffeuveenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtoh hmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghl vhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 8 Nov 2023 12:53:29 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1699466007; bh=FGYhQLTYJGYeFDRu9O7d0fhKGwUg74NVL/sZgE07mik=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=pxLkT5E2tzq8Ek0zQsJ16xa5KS468evCZTspEym122CS1bTzbCmAKEI0s7FrRR6vp GDREaN+sdGkDu0EIYxfaBy/WjxU2E4xSGr9zClu+P9WLux6fBNjvmlndYeu+0VXKbb fhP/v/Vdw2fj/fWJOSeho/f/iLdBpT5cw12EJ+ho+7fxHzIYMgcJYjD/Mr4aAMtbny F700HO9biH8LYSg4Q8FneFwtqKX8u6gO1ZnzkQt+LKxqJRckoVOlG4cJ5X81rWDAGH xiF/2pAbII6+QoSlXHJfjhyemtHSzS113I/0Rn/mDi2z67EPmgHYx9qUarjs0q5juk VyzjSQuLP63+A== Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 7B510C1; Wed, 8 Nov 2023 18:53:27 +0100 (CET) Date: Wed, 8 Nov 2023 18:53:27 +0100 From: Alvaro Herrera To: Alexander Lakhin Cc: Dean Rasheed , Peter Eisentraut , Robert Haas , pgsql-hackers@lists.postgresql.org Subject: Re: cataloguing NOT NULL constraints Message-ID: <202311081753.paidc6czdtmr@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 2023-Oct-12, Alexander Lakhin wrote: Hello, > I've discovered that that commit added several recursive functions, and > some of them are not protected from stack overflow. True. I reproduced the first two, but didn't attempt to reproduce the third one -- patching all these to check for stack depth is cheap protection. I also patched ATAddCheckNNConstraint: > (ATAddCheckNNConstraint() is protected because it calls > AddRelationNewConstraints(), which in turn calls StoreRelCheck() -> > CreateConstraintEntry() ->  recordDependencyOnSingleRelExpr() -> > find_expr_references_walker() ->  expression_tree_walker() -> > expression_tree_walker() -> check_stack_depth().) because it seems uselessly risky to rely on depth checks that exist on completely unrelated pieces of code, when the function visibly recurses on itself. Especially so since the test cases that demonstrate crashes are so expensive to run, which means we're not going to detect it if at some point that other stack depth check stops being called for whatever reason. BTW probably the tests could be made much cheaper by running the server with a lower "ulimit -s" setting. I didn't try. I noticed one more crash while trying to "drop table" one of the hierarchies your scripts create. But it's a preexisting issue which needs a backpatched fix, and I think Egor already reported it in the other thread. Thank you -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/ "Industry suffers from the managerial dogma that for the sake of stability and continuity, the company should be independent of the competence of individual employees." (E. Dijkstra)