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 1uHXRU-0049aN-99 for pgsql-hackers@arkaria.postgresql.org; Wed, 21 May 2025 00:36:20 +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 1uHXRT-000w6V-6a for pgsql-hackers@arkaria.postgresql.org; Wed, 21 May 2025 00:36:19 +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 1uHXRS-000w6N-SU for pgsql-hackers@lists.postgresql.org; Wed, 21 May 2025 00:36:18 +0000 Received: from mail-vk1-xa2b.google.com ([2607:f8b0:4864:20::a2b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uHXRN-0002wp-1l for pgsql-hackers@lists.postgresql.org; Wed, 21 May 2025 00:36:17 +0000 Received: by mail-vk1-xa2b.google.com with SMTP id 71dfb90a1353d-52eea8111easo891954e0c.2 for ; Tue, 20 May 2025 17:36:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747787773; x=1748392573; 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=HU1yVuTZWsJCoIw7swuvT68o0I34hMMhkRUUmTYlT7w=; b=E0HMu+kY2YCuZ9JEFZTuCwSHrLyvcj24Ix//MlNYTeXXjE/Z0+vDgQWqEviNsLEByp S+ZJRLN4yqnLDWvHaFh1bxvUBawEAElvjRXY5ng1FR7gubNLlr1yHdXPNEdqX1VTgzu8 +6nylrz8vzWm8uhiIxXOdpCx/QsWns0hMt0FTH1rgfXv8+JX7DLyh1gdapw827R8V//T WvhdX/OqCJJPJvMvUxH3PfgBXnYhxLD5GKPj9XuRMkRktSdrPTpwz7Q4NUnOhnfPY2vE peOeE8a7K6vgLQarGR3srXRB1+QMcD91NPWdiNsV1Yl7z3hfPxY6yl4cKk9K2u81/2Jo Vmjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747787773; x=1748392573; h=content-transfer-encoding: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=HU1yVuTZWsJCoIw7swuvT68o0I34hMMhkRUUmTYlT7w=; b=Nx6aTZfRvbWzUbe51XDz5qNDshrAmhYzP+iHZNCt/hIps2cipUpsaXTi4uImDbgaWV ij4JgebkLYYsLIlL/6puVXsEKhwkMGA9bnj50j1Fkr2/WKOXuVriaBCrPKDx/iQhTs0W CV+k4bwiLWcpY83snOQx1ACbh1o/5hXDdeE4Yy7HEAnt5gtb2jX62+vbG3PXcFG+8S3M E95M97tlpiwCgZW7usNcrj/+KlVfDbslH+RDCiKkNyFClmrFJ5f3W23iUHDyImP1OGlu HWp4UehT2GW9n1uX1p1USboj4fw5ZT3uTS5fyL7YSAY9pKvNqRLKW5yM8oORTsiN8WK0 1E2A== X-Gm-Message-State: AOJu0YwBJweRMI2OHYo5rOW2xm9fd1UMJfqjICH6IFapAPo7VfPA330T FzedgbwsspaDsyTNPMDKu0S3Nyj/amMrAsuTttnXldv+F/BzsxEeag7SKyCbH76jRgcvjdAB8oa McESe2/IB2xvRWFfnEd6BgujTtmrdzidVuiGgmWH69FJQ X-Gm-Gg: ASbGncuBo14K/6Di53OPyxPhQExti8VfNcpjGkNu979kBOhIEM+hSCClJGBvETLDEy2 izSPByUMOC4KyumAsWMu448VVic8UdyIY+jFBNb7On6ipqbdc7zt9QJq1YlveKPp+d7DpurACZj UUdi6HZHkvEC/FyaoacksGUHAnFXC1GgWAf4d8ZsFihvPzNd72Bvo0EdIhykfh X-Google-Smtp-Source: AGHT+IGFG0nE7zKMPLrJ5Rpws5zpkPgs7/IRRxp2iqr7sa5BSRq2DmBHr8dtedhMiG5/YjuL8m+gy/ehboRfxw9s3m0= X-Received: by 2002:a05:6122:6170:b0:52b:789:2d0 with SMTP id 71dfb90a1353d-52dbcd389e5mr14818615e0c.5.1747787772979; Tue, 20 May 2025 17:36:12 -0700 (PDT) MIME-Version: 1.0 References: <171085360143.2046436.7217841141682511557.pgcf@coridan.postgresql.org> <859476bf-3cb0-455e-b093-b8ab5ef17f0e@postgrespro.ru> <4e2764f7-f6be-478f-8d7f-f921dbd10f5f@postgrespro.ru> In-Reply-To: From: jian he Date: Wed, 21 May 2025 08:35:35 +0800 X-Gm-Features: AX0GCFvIS0qOnlrnVNSsG56gBGPe0Po6A0fHzg3xL1KN0EUwQVKYQnBJ_kK0JdU Message-ID: Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands To: Dmitry Koval Cc: pgsql-hackers@lists.postgresql.org 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 On Mon, May 12, 2025 at 4:31=E2=80=AFPM Dmitry Koval wrote: > > Hi! > > We (with colleagues) discussed further improvements to SPLIT/MERGE > PARTITION(S). As a result of the discussion, the following answers to > the questions remained: > > 1. Who should be the owner of new partitions (SPLIT PARTITION command) > if owner of the partition being split is not the same as the current user= ? > a) current user (since he is the one who creates new tables); > b) the owner of the partitioned partition (since it is the owner of the > table and should continue to own it). per https://www.postgresql.org/docs/current/sql-altertable.html "You must own the table to use ALTER TABLE." That means the current user must own the to be SPLITed partition. the new partitions owner should be current user (the one who did ALTER TABL= E) > 2. Who should be the owner of the new partition (MERGE PARTITIONS > command) if the partitions being merged have different owners? > a) current user (since he is the one who creates new table); > b) merging of partitions should be forbidden if they have different owner= s. > let say: alter table whatever_range merge partitions ( whatever_range_c, whatever_range_de ) into whatever_range_cde; In this case, the current user must own whatever_range_c and whatever_range_de to perform this operation. and the current user will be the owner of whatever_range_cde.