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.96) (envelope-from ) id 1wcL6E-003H47-2P for pgsql-hackers@arkaria.postgresql.org; Wed, 24 Jun 2026 10:44:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wcL6D-000Kvh-1x for pgsql-hackers@arkaria.postgresql.org; Wed, 24 Jun 2026 10:44:53 +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.96) (envelope-from ) id 1wcL6D-000KvZ-0v for pgsql-hackers@lists.postgresql.org; Wed, 24 Jun 2026 10:44:53 +0000 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wcL6B-000000000le-0wjD for pgsql-hackers@lists.postgresql.org; Wed, 24 Jun 2026 10:44:53 +0000 Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-69806f118d1so91879a12.1 for ; Wed, 24 Jun 2026 03:44:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1782297890; cv=none; d=google.com; s=arc-20240605; b=FFzl/1yhrTyT2FlEgt6thH+xlCQMPvIvHg3t7WEuTo6xrQMK279QfNFxp7221msmN1 8duTutDi00fVP+zraoSxuIl7tpIdvhD/rr1gLELtfMiqNTTBM5j7pxLLHG0tDbtyhF9x ztiCHCAh7Dv2MuQ6ZheBtd5VVQpF29V+29kxvxNAoo48qwUEsgbCKylG8Q5S1uDP+/50 IHEpl6x/vSItJkT+2NSjFpl3rX80lD/O5CgdbBC+ZEn+Hrc/1XUtnc3cr2DJiPkHCBTM 4R2dQ5mKDpuHgqu8srIGYBPVsx+AaiJPOH66sV+YHcOBiazUV6dkB2If45U2W3YAy6wo HNdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=qwqnCN860zRvVDB5gNQpk7lh27sb2QW0ueJER5/llT4=; fh=vQR9gwV7GEZ4FXoA5os9XACqziAA0zZC6hq+izZHoQU=; b=VOYJPkobVbCgmvFTRIbvzRw8YCUQcTKGxerD6yIGPvBNOCTvYvm0hyGReCFWV61cmm Dm7z1rUdf/UEo0JuX2hjgegmJz/FiMgmKoPBgX2oGsU/S2OwTNQNmvQ45Y++9uYHQ7j0 oqcfGri6Soe+v7mvBszyIWy6TfK5aExIKTMGOuA5u/vVML/5uZ0azrv6RK2eVgfuuMlN wvUwjaKfwXryFEcXYHBdDFnGqUAUhRVbBBLLZQSm4M5i0/ohJmChdl7v9FDaxVH1Bz2L Df6y3+xru9Uws1y1kN8RFx0gXP4t7t1pJX+GRTwBEsrh8q9dQCzN41LaTHWx9+2xLBzk MlCg==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782297890; x=1782902690; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=qwqnCN860zRvVDB5gNQpk7lh27sb2QW0ueJER5/llT4=; b=itwXfP9bEI6rOXhz4n9VNkSA/7gncgRR3MKz9EFDwPDh8hl55hfcYe9zHbHCgb6bu8 krwyGtXI9NI3aNLdvAJKOU6E0FoIROZXcXKXKiYyDEHXh19PcgJX+QbZRKxcGjKsyANg i4ssEJSsZSnuiT+vxTr9w07uD8naYdWqi0mUqgCP1orI0b3SOttEYPlKwHsD5GjvkMU3 T/qkLGPGx8WXvKua3EvxHnLGNXkDu1H+pdsw57jWZ7jCnWg5rTRIjvpynCAMoRmlLMmY mRmU7pKNigsOKnBL1VAeCWBQS7qf0CXu0GQ4DJRtgpi2nUJF3vpLm+Tr3FBq9Rg3fTNv OQUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782297890; x=1782902690; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=qwqnCN860zRvVDB5gNQpk7lh27sb2QW0ueJER5/llT4=; b=DbKSGTsY2vpHIBHBZgknr97EWKDqCIEE4lSF+pPlpN8cQqYgc6k9CONf/+8LLgTl4w eIs4BQOMtgzrdU0BS+MEjru+NmYFDLonbrWvWHbiujuo7OFzCOCYBjjUMDXTBdGWTlyk geS4JleZDuaxXCpJ35AT1b2r9Q/k5vmPkVJRTAwpFD6AFC0tdPqxsxtSRUp6Kc2B0ciJ PMjGAip5DCaD7w8WARE9fL6dSUKtCHOTcMW77glsLh0NQDox7FJ9HeIbcdDU0/Ei9zCW rWLHoBm/ZLJmAJo3R1A9VUvnazznpNoaZwKkcLgbr2iIm5oqh/zxCQ8BPXJtgp6oGduX CV9A== X-Forwarded-Encrypted: i=1; AHgh+RoIDmnpcpywKYDfMzhl+37XKocslkZIbVT81ltyaHbCdoMLqVgL8C6hjLbT4ni0mCCQTKUULiSWQLoWZ3oM@lists.postgresql.org X-Gm-Message-State: AOJu0Yyre5ieW+MmqJQjpltVEM38OboZEfjYJdtauSK7+ROz80hZMvnC ypuYtaCOpufNvyZgwwQH10SHZLpG8VkrL9f36J4+mZDbmGQAs/eFmKBohv8t3dZQS/lH9Ppxvzl qSqI5pHjHpUBygpoEVSeo5y4vXa9LII4= X-Gm-Gg: AfdE7clTDqyfx8LwsyWWIjE3qPZ3CZamFR2d7ay+JDwNHHYXGdb7YZs0Nj6tZtr/p1h Ew1GqzHNIYh2ZPtJtdvucHMZNKxn5k7/V4nvD7cv0soQ7hHEEXfxIweERV+bpCZl/YvYqUzv9sY esd6ZHG2V1D6PYv+YHTV0du+HbfI7XuH6q4EwbJpTwv5xSPeJjn7axgkZvVhsopoe4o16E+avnQ +EhzI4ZRgBIxoVE0FkrLCe8qL17qFkvkDyG6bJFFoUVE5ywgFU46L2BehXvJGl+Jc+nm9fW73Q= X-Received: by 2002:a05:6402:5307:b0:695:ec53:976e with SMTP id 4fb4d7f45d1cf-697f3af8669mr1259038a12.26.1782297889430; Wed, 24 Jun 2026 03:44:49 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Pavel Borisov Date: Wed, 24 Jun 2026 14:44:35 +0400 X-Gm-Features: AVVi8Cet0d2aKA5xfG-7G2JGOl_EvAIzRcZPxFnLlOZd--M1sBvk_6itV1UZCAw Message-ID: Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands To: Alexander Korotkov Cc: Justin Pryzby , Dmitry Koval , Alexander Lakhin , pgsql-hackers@lists.postgresql.org, Tomas Vondra , Alvaro Herrera Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, Alexander! On Wed, 24 Jun 2026 at 14:25, Alexander Korotkov wro= te: > > On Mon, Jun 22, 2026 at 1:44=E2=80=AFPM Pavel Borisov wrote: > > On Sun, 21 Jun 2026 at 16:11, Alexander Korotkov = wrote: > > > > > > On Thu, Jun 18, 2026 at 6:49=E2=80=AFPM Justin Pryzby wrote: > > > > On Thu, Jun 18, 2026 at 10:31:11AM +0300, Alexander Korotkov wrote: > > > > > Pushed with your suggestions accepted. > > > > > > > > Thanks. When I went back to test this, I merged ~25 partitions tha= t > > > > were all on the same tablespace, but the merged table was created o= n the > > > > default tablespace. > > > > > > > > I tried again with default_tablespace set, but it was ignored. I t= hink > > > > that's wrong. It's good to follow the tablespace of the parent tab= le, > > > > but if it has no tablespace set, default_tablespace should be obeye= d. > > > > See surrounding logic in DefineRelation. > > > > > > > > I see the docs say this: > > > > + ALTER TABLE MERGE PARTITION uses the par= titioned > > > > + table itself as the template to construct the new partition= . > > > > + The new partition will inherit the same table access method= , persistence > > > > + type, and tablespace as the partitioned table. > > > > > > Correct, please see the attached patch, it makes > > > createPartitionTable() deal with tablespaces the same was as > > > DefineRelation() does. > > > > Thank you for working on this feature! > > I've looked into the last v1 patch. > > > > Does it also worth inheriting DefineRelation()'s check and error for > > the case if (tablespaceId =3D=3D GLOBALTABLESPACE_OID)? > > A brief look for default_tablespace GUC doesn't reveal a way why it > > could not be set to global tablespace in a session. > > Thank you for catching this. I've added this check and corresponding tes= ts. Looked at the patch v2. I think in test we'd better split comments for the failing block (SET default_tablespace TO pg_global;) and for the successful block (after RESET default_tablespace;). Otherwise, the comment paragraph looks a little hard to read to me: +-- Parent has no explicit tablespace and default_tablespace is empty: the +-- new partition uses the database default (reltablespace =3D 0). Also +-- exercise the pg_global rejection path with default_tablespace pointing +-- at the shared tablespace. Overall the patch looks good to me. Regards, Pavel Borisov Supabase