Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pNHle-0004SL-8P for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Feb 2023 18:23:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pNHld-0001Y0-48 for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Feb 2023 18:23:33 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pNHlc-0001Xi-R4 for pgsql-hackers@lists.postgresql.org; Wed, 01 Feb 2023 18:23:32 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pNHla-0005ik-IS for pgsql-hackers@lists.postgresql.org; Wed, 01 Feb 2023 18:23:31 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 311INQj91396808; Wed, 1 Feb 2023 13:23:26 -0500 From: Tom Lane To: Robert Haas cc: pgsql-hackers@lists.postgresql.org, Andrew Subject: Re: pg_dump versus hash partitioning In-reply-to: References: <1376149.1675268279@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Wed, 01 Feb 2023 12:39:32 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1396806.1675275806.1@sss.pgh.pa.us> Date: Wed, 01 Feb 2023 13:23:26 -0500 Message-ID: <1396807.1675275806@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Robert Haas writes: > On Wed, Feb 1, 2023 at 11:18 AM Tom Lane wrote: >> Over at [1] we have a complaint that dump-and-restore fails for >> hash-partitioned tables if a partitioning column is an enum, >> because the enum values are unlikely to receive the same OIDs >> in the destination database as they had in the source, and the >> hash codes are dependent on those OIDs. > It seems to me that this is the root of the problem. Well, that was what I thought too to start with, but I now think that it is far too narrow-minded a view of the problem. The real issue is something I said that you trimmed: >> In general, we've never thought that hash values are >> required to be consistent across platforms. hashenum() is doing something that is perfectly fine in the context of hash indexes, which have traditionally been our standard of how reproducible hash values need to be. Hash partitioning has moved those goalposts, and if there was any discussion of the consequences of that, I didn't see it. >> Furthermore, I think we should make this happen in time for >> next week's releases. I can write the patch easily enough, >> but we need a consensus PDQ that this is what to do. > This seems extremely precipitous to me and I'm against it. Yeah, it's been this way for awhile, so if there's debate then we can let it go awhile longer. > So I think we should be asking ourselves what we could do about the > enum case specifically, rather than resorting to a bazooka. My idea of solving this with a bazooka would be to deprecate hash partitioning. Quite frankly that's where I think we will end up someday, but I'm not going to try to make that argument today. In the meantime, I think we need to recognize that hash values are not very portable. I do not think we do our users a service by letting them discover the corner cases the hard way. I'd be willing to compromise on the intermediate idea of forcing --load-via-partition-root just for hashed partitioning. regards, tom lane