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 1pNL2C-00031z-85 for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Feb 2023 21:52:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pNL2B-0008Fs-46 for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Feb 2023 21:52:51 +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 1pNL2A-0008Fg-R3 for pgsql-hackers@lists.postgresql.org; Wed, 01 Feb 2023 21:52:50 +0000 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pNL24-0007Vk-5D for pgsql-hackers@lists.postgresql.org; Wed, 01 Feb 2023 21:52:49 +0000 Received: by mail-lj1-x232.google.com with SMTP id x29so11049ljq.0 for ; Wed, 01 Feb 2023 13:52:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=EdqU8fxOCQb6POu3iELHRlfh71EnDqUINiHK2SVW40s=; b=lSZBEmirkDzP6jhhJhdBuvqddrSDjq3wym1GZyl9nN5yPK+5bOB/YZp49QNi57Pqz+ jVJtKahTj8WZPi+s+rP5S27ZAwJzdyplQuDO8qbk5ybNZLx3yByIUIKk7ke/CiIenZqc lnYNcb707+pJQp9foC/i5FBeebL3DPHRUikVpwwKVHNaHOm7Tsji+7o6vU68TNw/J5fc GjMHy50WWj4MV8SsQV99+6c9/r394EcUCxSwnGvg2UtS4Y9kj7DcpQ31pFwY9+4QHiQh OZOEQdLTY0w1z0z4QNmuwRQ/jJCwT8R8dJ+bUiFnZuuBW+hpKn2qNzLjzxFdgYmHJlJH g3zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=EdqU8fxOCQb6POu3iELHRlfh71EnDqUINiHK2SVW40s=; b=GW98NsV3SEgbLjl4PnijcU9zTqqt5miNvQ7F+rGHTK9BmbCqH0gc3YhqnlFh+OZEET tq5eV/t4nssdaTU2P4W8U5a8QXPVGeHALm1yGB5N6sFK5B6daFtouhfUzhRASy6QC1AE cNeIBJbxAEuMtOJsiikYVYoIeLTALs84aAw0xDpX5MPdQiwsYfM5njaSDhhc0BWZEdf4 5wFWYUvG8u3NwchBndIqG97W4ssFqwtrTTSWy14aIObAAJXraE+Xl321fDUEex/a89dn Tua2iqMxHg7ESE2zqY+I5ZtSwTL71c97OqagEpDKxb9i9xZyP49ZTGl5+e7YN4nkejN1 z9bA== X-Gm-Message-State: AO0yUKVFWJKVCdHism55hN3JhVNt7oaR2iccFjCax98di+8tHUYLHIjt lHbNYBZymvYitCiOlL+2h5MeC2CpZfXEoBOaRBk= X-Google-Smtp-Source: AK7set/CRlgJn3Hcwhoiq/hNOuvX+YzclEfetz5QTQAjqKzVp9GJiMllJt+Ql+bswnqo2e0ijbLKxE+OjYPF8RCR5cs= X-Received: by 2002:a2e:b0f4:0:b0:28f:3b6:f84a with SMTP id h20-20020a2eb0f4000000b0028f03b6f84amr490028ljl.41.1675288362466; Wed, 01 Feb 2023 13:52:42 -0800 (PST) MIME-Version: 1.0 References: <1376149.1675268279@sss.pgh.pa.us> <1396807.1675275806@sss.pgh.pa.us> <1416220.1675285933@sss.pgh.pa.us> In-Reply-To: <1416220.1675285933@sss.pgh.pa.us> From: Robert Haas Date: Wed, 1 Feb 2023 16:52:30 -0500 Message-ID: Subject: Re: pg_dump versus hash partitioning To: Tom Lane Cc: pgsql-hackers@lists.postgresql.org, Andrew Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Feb 1, 2023 at 4:12 PM Tom Lane wrote: > > I don't think the fact that our *traditional* standard for how stable > > a hash function needs to be has been XYZ carries any water. > > Well, it wouldn't need to if we had a practical way of changing the > behavior of an existing hash function, but guess what: we don't. > Andrew's original proposal for fixing this was exactly to change the > behavior of hashenum(). There were some problems with the idea of > depending on enumsortorder instead of enum OID, but the really > fundamental issue is that you can't change hashing behavior without > breaking pg_upgrade completely. Not only will your hash indexes be > corrupt, but your hash-partitioned tables will be broken, in exactly > the same way that we're trying to solve for dump/reload cases (which > of course will *also* be broken by redefining the hash function, if > you didn't use --load-via-partition-root). Moreover, while we can > always advise people to reindex, there's no similarly easy way to fix > broken partitioning. > > That being the case, I don't think moving the goalposts for hash > function stability is going to lead to a workable solution. I don't see that there is any easy, clean way to solve this in released branches. The idea that I proposed could be implemented in master, and I think it is the right kind of fix, but it is not back-patchable. However, I think your argument rests on the premise that making --load-via-partition-root the default behavior in some or all cases will not break anything for anyone, and I'm skeptical. I think that's a significant behavior change and that some people will notice, and some will find it an improvement while others will find it worse than the current behavior. I also think that there must be a lot more people using partitioning in general, and even hash partitioning specifically, than there are people using hash partitioning on an enum column. Personally, I would rather disallow this case in the back-branches -- i.e. make pg_dump barf if it is encountered and block CREATE TABLE from setting up any new situations of this type -- than foist --load-via-partition-root on many people who aren't affected by the issue. I'm not saying that's a great answer, but we have to pick from the choices we have. I also don't accept that if someone has hit this issue they are just hosed and there's no way out. Yeah, it's not a lot of fun: you probably have to use "CREATE TABLE unpartitioned AS SELECT * FROM borked; DROP TABLE borked;" or so to rescue your data. But what would we do if we discovered that the btree opclass sorts 1 before 0, or something? Surely we wouldn't refuse to fix the opclass just because some users have existing indexes on disk that would be out of order with the new opclass definition. We'd just change it and people would have to deal. People with indexes would need to reindex. People with partitioning boundaries between 0 and 1 would need to repartition. This case isn't the same because hashenum() isn't broken in general, just for this particular purpose. But I think you're trying to argue that we should fix this by changing something other than the thing that is broken, and I don't agree with that. -- Robert Haas EDB: http://www.enterprisedb.com