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 1sp60F-00GUzD-TK for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Sep 2024 13:06:24 +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 1sp60E-002g7z-Px for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Sep 2024 13:06:22 +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 1sp60E-002g7f-Fn for pgsql-hackers@lists.postgresql.org; Fri, 13 Sep 2024 13:06:22 +0000 Received: from smtp.outgoing.loopia.se ([93.188.3.37]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sp60A-000y41-Hl for pgsql-hackers@lists.postgresql.org; Fri, 13 Sep 2024 13:06:21 +0000 Received: from s807.loopia.se (localhost [127.0.0.1]) by s807.loopia.se (Postfix) with ESMTP id E27E6E0D3F for ; Fri, 13 Sep 2024 15:05:50 +0200 (CEST) Received: from s981.loopia.se (unknown [172.22.191.5]) by s807.loopia.se (Postfix) with ESMTP id CE839E1D17; Fri, 13 Sep 2024 15:05:50 +0200 (CEST) Received: from s473.loopia.se (unknown [172.22.191.5]) by s981.loopia.se (Postfix) with ESMTP id CCB5A22B17AC; Fri, 13 Sep 2024 15:05:50 +0200 (CEST) X-Virus-Scanned: amavisd-new at amavis.loopia.se X-Spam-Flag: NO X-Spam-Score: -1.2 X-Spam-Level: X-Spam-Status: No, score=-1.2 tagged_above=-999 required=6.2 tests=[ALL_TRUSTED=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1] autolearn=disabled Authentication-Results: s473.loopia.se (amavisd-new); dkim=pass (2048-bit key) header.d=proxel.se Received: from s899.loopia.se ([172.22.191.5]) by s473.loopia.se (s473.loopia.se [172.22.190.13]) (amavisd-new, port 10024) with UTF8LMTP id 1PhD5ltCljri; Fri, 13 Sep 2024 15:05:50 +0200 (CEST) X-Loopia-Auth: user X-Loopia-User: andreas@proxel.se X-Loopia-Originating-IP: 158.174.129.34 Received: from [192.168.0.189] (h-158-174-129-34.NA.cust.bahnhof.se [158.174.129.34]) (Authenticated sender: andreas@proxel.se) by s899.loopia.se (Postfix) with ESMTPSA id 479CC2C8BA4D; Fri, 13 Sep 2024 15:05:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proxel.se; s=loopiadkim1707418970; t=1726232750; bh=lDtPfJKWgF3hNVhOBtVINji6jjOn4iV8kXyEuxGYIX0=; h=Date:Subject:To:References:From:In-Reply-To; b=Kvi8tFJnsnrWvuFVoxWa+OrGxOciJzFy1Yf8Llm7iL+vTkKBF9s5De7GJeaXSsvXp 0fK6m2f0bJdDxoMCVruUt8pABry2DuAnOmt4nTp8TLSrHfn/CgkU9w+QUoJzpPVWnr L/iZiBpKKeMoOPh3RbescYSjkzR4xQTJUOGHGAVKiDbf2JD0N7HG9A9rwXDV0tA7zw Q5SvXGfNBmvC336c0mnzOAQ1s6gGklI2JPLkwxZ/uI/qmgAChIdPgEBUYjZg3+4iDY Jt1e/c/+yW0VYA6H9MBxva0xt5Eb4JPHR8uphD6lONg/pHpJQOq100C87dYsMHUd4h 7aIAEEZUM8d0w== Message-ID: <7c9f8c8b-e5ca-4675-bc1c-f27789059ee7@proxel.se> Date: Fri, 13 Sep 2024 15:05:49 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Mutable foreign key constraints To: Laurenz Albe , Tom Lane , pgsql-hackers@lists.postgresql.org References: <4162598.1726176826@sss.pgh.pa.us> <560b5873c9b8129a4b7b4fe3239ec32363168599.camel@cybertec.at> Content-Language: en-US From: Andreas Karlsson In-Reply-To: <560b5873c9b8129a4b7b4fe3239ec32363168599.camel@cybertec.at> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 9/13/24 4:41 AM, Laurenz Albe wrote: > That's very broken and should not be allowed. +1 >> A possible objection is that if anybody has such a setup and >> hasn't noticed a problem because they never change their >> timezone setting, they might not appreciate us breaking it. > > I hope that there are few cases of that in the field, and I think it > is OK to break them. After all, it can be fixed with a simple > > ALTER TABLE foo ALTER id TYPE timestamptz; > > If the session time zone is UTC, that wouldn't even require a rewrite. > > I agree that it cannot be backpatched. I unfortunately suspect there might be more cases than we think in the field due to many people not understanding the difference between timestamp and timestamptz but the good thing is that timestamp/timestamptz are rare in foreign keys, even in composite ones. Since this is quite broken and does not have any real world usefulness I think we should just go ahead and disallow it and have a few people complain. Andreas