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 1oBhYL-0003y2-FG for pgsql-hackers@arkaria.postgresql.org; Wed, 13 Jul 2022 18:57:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oBhYJ-0004ks-Db for pgsql-hackers@arkaria.postgresql.org; Wed, 13 Jul 2022 18:57:39 +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 1oBhYJ-0004iI-2N for pgsql-hackers@lists.postgresql.org; Wed, 13 Jul 2022 18:57:39 +0000 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oBhYC-0000Sx-Dz for pgsql-hackers@lists.postgresql.org; Wed, 13 Jul 2022 18:57:37 +0000 Received: by mail-lf1-x12a.google.com with SMTP id bf9so20544634lfb.13 for ; Wed, 13 Jul 2022 11:57:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yugabyte.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AGxCFTCk/uwggg/ZnwNLU5V6MGKTvoZEJycANhnmcGw=; b=MtivkdPKh769atzOeevO18dLtdXyd1eidIyHm706FbBWMb9VzKeqJRHaFWwrKaEwf7 sPXNMtdSOcq5jLO+guQ25pSR6vrcNyGNINBNkbVZJasEpyfug8qIPmF+rB6mbwAaIPsk zMf2TCkTTCElJ/tvZpv1adKncPOKLil4h8R3Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AGxCFTCk/uwggg/ZnwNLU5V6MGKTvoZEJycANhnmcGw=; b=o4OnBaLs8lr5RawMcCdaGMN+SBCVMK1XC5ctrPOd1ugqWKNVb1B/4z2DoqizzQqD2+ 3PvcgOIv8BBZd/9EJxEBwO7l8NEtFu3kmdv2cMccD/vf8m5khzJv5WoNTMOPQzD13UOT h6ug/86TQF/JnwU2Wu9DZWCXbtwO+Umdo2pIOrxvDs7TSjKExWjr7hc91ZhIUX92QOBk DOdLWco2QMEHgsUPCrFvu1sYYcolJbYbBFnMNwdyjOSytxhjwPhk1vNqr+SDaxdGRUDU wNvBUIN3+A1njFOPk//6+L8+FtBo6oLjtHikkYcFE1gBxb73Dc2+pracyRaR+CC1mrbM yBGw== X-Gm-Message-State: AJIora9r+ERR62aKY4OF9qunUjV4z7h6JP7ln5h0UmcpQoDb7satXVPE BGu9mq+p4dEcjX60WA/Xzp0cKldf5wsPbPoubgzbNA== X-Google-Smtp-Source: AGRyM1s7igQXHyyX77hdTJYaOu95dUM5bfBtWowL9ctN+U/UOJEvMiPF7BFvFO7flgAVKByZKXS+tWtQYFNAyiy+G0I= X-Received: by 2002:a05:6512:2256:b0:485:8ce:d829 with SMTP id i22-20020a056512225600b0048508ced829mr2987576lfu.137.1657738649950; Wed, 13 Jul 2022 11:57:29 -0700 (PDT) MIME-Version: 1.0 References: <163714495450.16056.3566953095730878367@malur.postgresql.org> <82ed3466-9855-ccd6-e2a3-a3a92166ff01@postgrespro.ru> In-Reply-To: <82ed3466-9855-ccd6-e2a3-a3a92166ff01@postgrespro.ru> From: Zhihong Yu Date: Wed, 13 Jul 2022 12:03:46 -0700 Message-ID: Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands To: Dmitry Koval Cc: PostgreSQL Hackers Content-Type: multipart/alternative; boundary="0000000000005c779905e3b45b1f" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000005c779905e3b45b1f Content-Type: text/plain; charset="UTF-8" On Wed, Jul 13, 2022 at 11:28 AM Dmitry Koval wrote: > Hi! > > Patch stop applying due to changes in upstream. > Here is a rebased version. > > -- > With best regards, > Dmitry Koval > > Postgres Professional: http://postgrespro.com Hi, +attachPartTable(List **wqueue, Relation rel, Relation partition, PartitionBoundSpec *bound) I checked naming of existing methods, such as AttachPartitionEnsureIndexes. I think it would be better if the above method is named attachPartitionTable. + if (!defaultPartCtx && OidIsValid(defaultPartOid)) + { + pc = createSplitPartitionContext(table_open(defaultPartOid, AccessExclusiveLock)); Since the value of pc would be passed to defaultPartCtx, there is no need to assign to pc above. You can assign directly to defaultPartCtx. + /* Drop splitted partition. */ splitted -> split + /* Rename new partition if it is need. */ need -> needed. Cheers --0000000000005c779905e3b45b1f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Wed, Jul 13, 2022 at 11:28 AM Dmit= ry Koval <d.koval@postgrespro.= ru> wrote:
http://postgrespro.com
Hi,

+attachPartTable(List **wqueue, Relation rel, Relation pa= rtition, PartitionBoundSpec *bound)=C2=A0

I checke= d naming of existing methods, such as=C2=A0AttachPartitionEnsureIndexes.
I think it would be better if the above method is named=C2=A0attach= PartitionTable.

+ =C2=A0 if (!defaultPartCtx &= & OidIsValid(defaultPartOid))
+ =C2=A0 {
+ =C2=A0 =C2=A0 =C2=A0 p= c =3D createSplitPartitionContext(table_open(defaultPartOid, AccessExclusiv= eLock));

Since the value of pc would be passed= to=C2=A0defaultPartCtx, there is no need to assign to pc above. You can as= sign directly to=C2=A0defaultPartCtx.

+ =C2=A0 /* = Drop splitted partition. */

splitted -> spl= it

+ =C2=A0 /* Rename new partition if it is n= eed. */

need -> needed.

Cheers
--0000000000005c779905e3b45b1f--