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 1rhYRM-00C6Jx-8w for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Mar 2024 17:18:56 +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 1rhYRK-0018yO-QI for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Mar 2024 17:18:55 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rhYRK-0018wd-DH for pgsql-hackers@lists.postgresql.org; Tue, 05 Mar 2024 17:18:55 +0000 Received: from wfout4-smtp.messagingengine.com ([64.147.123.147]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rhYRH-0030CH-0n for pgsql-hackers@postgresql.org; Tue, 05 Mar 2024 17:18:53 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfout.west.internal (Postfix) with ESMTP id 7B37F1C000BF; Tue, 5 Mar 2024 12:18:48 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 05 Mar 2024 12:18:48 -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:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1709659128; x= 1709745528; bh=1cjXXwyGzfUf/UQz4pVeOCNy8ues2nW2popVv6ZaxkE=; b=N IOQoEiBXwN8sC3RikqkpfwEGsTye7u9235CPPYu8w3sifEqVnYV2UKiS/fueHW2w ICVyYb2bpuV2IYl6JHTBJaQzQKJfAohQcy32uAzme/4rGZMB+T1vDPFM5SXcb24Q OgDPXIloQoYHVY94QXdDQmthhLx6YHaTtFKshfTc/c+LL5xqPeplbwiZNr6XMkOr AxIaCSlhlYdVuAMw6ZXV+3mQuOF6wuCitLHSw9YL9dvVMvFvg3eJe+gFU6k0Ct2V x0Vg4X+vL2nyyazYBJ2MpA3VbMF2p9+HkpmFinUcVv+HE49+tHrEbb0XIUFs6TLP UTbfyo94tv+6YV8oBRZNg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrheelgdelgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetlhhvrghr ohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgqe enucggtffrrghtthgvrhhnpefgtdegleeggffftdeiuddufffhveekgfdufeethefgtefh kedvgeejlefhteehvdenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmpd hpohhsthhgrhgvshhqlhdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgr mhepmhgrihhlfhhrohhmpegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 5 Mar 2024 12:18:47 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1709659125; bh=hNN+6WmMPFygec9UMj3i0bQ5vu5BBkQxpH4DNR+/tbg=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=ZTIJ3vdDDLFklFUoOos4fNDwFeX2K5/72tgfsZSjOGg2wr6BfXMC63shfBy6otNMD cbBou1FK/djRW4uD7yscK43nP/AvfyEOFZ7XqxvcQs3NK9hqlqU24EXPAVNUQWRQ4j IXlNOHOtyFWCi7GXCRHxB7UPTnKaxuCOq+PD8y9o7kAgwTEQYPUygJWrnct2IzMHJM PniYILwxjNgZdMDB0T8hTXX0RBbobmtkq/9NfviukyRqBBSXVqypUzF24/rpVKhaHl IFzYEPEAoinYOnN8zU7K4O4wflMjkYsbH4vB6XZ39v17lEo35HpmUrhyvmJWIVSnNo EwNGTjjjBRs8Q== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id 25134CD5; Tue, 5 Mar 2024 18:18:45 +0100 (CET) Date: Tue, 5 Mar 2024 18:18:45 +0100 From: Alvaro Herrera To: Dean Rasheed Cc: Aleksander Alekseev , PostgreSQL-development , Amul Sul , vignesh C Subject: Re: Dump-restore loosing 'attnotnull' bit for DEFERRABLE PRIMARY KEY column(s). Message-ID: <202403051718.uknrc5p2ivhu@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-Mar-05, Dean Rasheed wrote: > Looking at the other places that call RelationGetIndexAttrBitmap() > with INDEX_ATTR_BITMAP_PRIMARY_KEY, they all appear to want to include > deferrable PKs, since they are relying on the result to see which > columns are not nullable. Hmm, I find this pretty surprising, but you are right. Somehow I had the idea that INDEX_ATTR_BITMAP_PRIMARY_KEY was used for planning activities so I didn't want to modify its behavior ... but clearly that's not at all the case. It's only used for DDL, and one check in logical replication. > So there are other bugs here. For example: > > CREATE TABLE foo (id int PRIMARY KEY DEFERRABLE, val text); > CREATE TABLE bar (LIKE foo); > > now fails to mark bar.id as not nullable, whereas prior to > b0e96f311985 it would have been. Fun. (Thankfully, easy to fix. But I'll add this as a test too.) > So I think RelationGetIndexAttrBitmap() should include deferrable PKs, Yeah, I'll go make it so. I think I'll add a test for the case that changes behavior in logical replication first (which is that the target relation of logical replication is currently not marked as updatable, when its PK is deferrable). > but not all the changes made to RelationGetIndexList() by b0e96f311985 > need reverting. I'll give this a look too. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ "Once again, thank you and all of the developers for your hard work on PostgreSQL. This is by far the most pleasant management experience of any database I've worked on." (Dan Harris) http://archives.postgresql.org/pgsql-performance/2006-04/msg00247.php