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 1s3BZW-00AIVT-81 for pgsql-hackers@arkaria.postgresql.org; Sat, 04 May 2024 09:20:46 +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 1s3BZS-00GUlQ-5W for pgsql-hackers@arkaria.postgresql.org; Sat, 04 May 2024 09:20:43 +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 1s3BZR-00GUlF-4v for pgsql-hackers@lists.postgresql.org; Sat, 04 May 2024 09:20:42 +0000 Received: from fout4-smtp.messagingengine.com ([103.168.172.147]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s3BZO-001UOw-8u for pgsql-hackers@lists.postgresql.org; Sat, 04 May 2024 09:20:41 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailfout.nyi.internal (Postfix) with ESMTP id 07EDF1380258; Sat, 4 May 2024 05:20:36 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Sat, 04 May 2024 05:20:36 -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=fm3; t=1714814436; x= 1714900836; bh=jFU144e9IaqIop2YV2LOUvLJ/mPVcr17F8Vw1U7KwkM=; b=C EnBA3hzsGRnzvrpXOqkmlwS0BscLzGIHDvQKWp1ejLHLsbBoJZlpXYIH//LLhLx8 ykbCSyZUa/rIOplJfqeb4VYmFdIOScQ4Os1vrjDG1KfPvA1acIsG4T7kg361tydn H3vD2sP9jNDeS8rlfs7sFTeqwssq8/MiNYH38tKSA3HSRtB/6+JOp/QSQl36K2dG 4Qo2qR4DYqII5kxE1ht+1IhAwzJ+9iFlbQi1r+4bWltuBeecWmuOvSnriI+eX+i4 28CQN3DdbPn39YMEi7sYPxMlo4Ekj4LAokkJx4qlpVHTjHSFfC0VUU3Wfb3PHMpI P7dWpmPkWS6j0boUVc4gg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvddvvddgudeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepvdektdffudfftdffffehfffhjeejhffgieeuueekjeek fffgudffhfduffffueevnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhv hhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 4 May 2024 05:20:34 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1714814432; bh=DiKrqV2sCxCS0I91YUh7FXmjbN4qVWyhB6p6egdSTXE=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=nTnBC0WXbeHvvMVAB1BL3RFiiGfZaS4u+l6bmcc7Rb80You72DxCyd6Ad4Bfv9LQG By9o2UaggZXzJMnSjsZqR99QdrgnTe0CAn1DIb/k49z9vWFmdNTbFfG4ZzVi8lbjC+ RP0GijKgeQWEXY1hixeVKQ5/hUMV7bqdulkUH0Vsy24zRrb096OVTn16x4Moh1x8kR O62lrKOYzmOoZ++BfF7Hknqu/o7nR49Xewc7kyN6UaRVPO5RYhwbLRdfukwIuyHlyg /WdeitaH4R4tCFoKh5xx01mHznoIeJ9/195FPbnQlAOAiV6EyyK6yCjM7ukvhvvWT8 oLtULbEHhbRCw== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id 892369A; Sat, 4 May 2024 11:20:32 +0200 (CEST) Date: Sat, 4 May 2024 11:20:32 +0200 From: Alvaro Herrera To: Justin Pryzby Cc: Robert Haas , Kyotaro Horiguchi , pgsql-hackers@lists.postgresql.org, Alexander Lakhin , Dmitry Koval Subject: Re: pg17 issues with not-null contraints Message-ID: <202405040920.2rg4mmjgv3ch@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-May-03, Justin Pryzby wrote: > But if it's created with LIKE: > postgres=# CREATE TABLE t1 (LIKE t); > postgres=# ALTER TABLE t ATTACH PARTITION t1 DEFAULT ; > > ..one also sees: > > Not-null constraints: > "t1_i_not_null" NOT NULL "i" Hmm, I think the problem here is not ATTACH; the not-null constraint is there immediately after CREATE. I think this is all right actually, because we derive a not-null constraint from the primary key and this is definitely intentional. But I also think that if you do CREATE TABLE t1 (LIKE t INCLUDING CONSTRAINTS) then you should get only the primary key and no separate not-null constraint. That will make the table more similar to the one being copied. Does that make sense to you? -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ "Estoy de acuerdo contigo en que la verdad absoluta no existe... El problema es que la mentira sí existe y tu estás mintiendo" (G. Lama)