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 1oiIqs-0008Aa-0s for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Oct 2022 17:15: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 1oiIqq-0006nh-Ip for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Oct 2022 17:15:32 +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 1oiIqq-0006nW-9B for pgsql-hackers@lists.postgresql.org; Tue, 11 Oct 2022 17:15:32 +0000 Received: from mail-yw1-x1129.google.com ([2607:f8b0:4864:20::1129]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oiIqn-0001fM-Bw for pgsql-hackers@lists.postgresql.org; Tue, 11 Oct 2022 17:15:31 +0000 Received: by mail-yw1-x1129.google.com with SMTP id 00721157ae682-3573ed7cc15so133688797b3.1 for ; Tue, 11 Oct 2022 10:15:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yugabyte.com; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ROq5kzKblT7xSKgSpt5MVKnvaTGAbtfEFlm90M8s3x0=; b=MrzPO/2enq0Lnd+gb6hYw7apyqvRLw6jhGLfevdgnmv49U/HJmccROoMeBSalYjGcO ju3yMtHUvvZ52LwbRil7FcIoIMHAmuZhHObl+/8ScR6YKKxc6Yah4HG6pDAPc8JewVlX FPjjUQCqZMjDgXWyrGJH18fAzZSSmMSBaLuzQ= 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=ROq5kzKblT7xSKgSpt5MVKnvaTGAbtfEFlm90M8s3x0=; b=CNQYT5ZcmRxZx6/jTgw5m/v8YZk9uWsTORYaTsIUq1Xd/4LIsHL0tGczi/zlqQLWs7 EUgFt8wZ2uyywUoCIMUi6FUvKTREYH++9FMCOaY9BEkqsRApWGOudnwFh5+T4wwGUuBk KqX7w+5jjawa8JuG7M2GPcWtVnHvyB8mwjMhKna50kXKTXEaDMYxr2YknwI5sfkFIe/X 0IabjRISGJnwbDuhMrV9ufM23UyJVdttx2OwZ3nj+3QkUfx1kK0vI+0cpUA0ZqMUrM1S 1I9Mmy0vGdktK8dnhOnx9YxwJCjozkFDtSCiAELFJsDpnK8Z/RdQohf3ec5Ty3BgRE55 9bfA== X-Gm-Message-State: ACrzQf2/A6hc74Wlq2qEbqhNiQD+PBDq1g98cy8qxa4r7ArznovinFY6 6su35chV7ApC6Pogznxp2WXIP4hUuglU9caTgfp7+Q== X-Google-Smtp-Source: AMsMyM7uT0lKuAjlvzqR26ktrgUUJSF2rNiWQeKeEqITg26XtdgOlyRdfcF1YITlSGDHNqNTb5nuAJYAtj82xyy1XDA= X-Received: by 2002:a81:80c3:0:b0:349:8498:a05b with SMTP id q186-20020a8180c3000000b003498498a05bmr23088092ywf.403.1665508528676; Tue, 11 Oct 2022 10:15:28 -0700 (PDT) MIME-Version: 1.0 References: <163714495450.16056.3566953095730878367@malur.postgresql.org> <9186127e-8f8f-cbd3-40de-b7bf01e57fb5@postgrespro.ru> In-Reply-To: From: Zhihong Yu Date: Tue, 11 Oct 2022 10:15:05 -0700 Message-ID: Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands To: Dmitry Koval Cc: PostgreSQL Hackers Content-Type: multipart/alternative; boundary="00000000000038f6bb05eac56cb3" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000038f6bb05eac56cb3 Content-Type: text/plain; charset="UTF-8" On Tue, Oct 11, 2022 at 9:58 AM Zhihong Yu wrote: > > > On Tue, Oct 11, 2022 at 9:22 AM Dmitry Koval > wrote: > >> Hi! >> >> Fixed couple warnings (for cfbot). >> >> -- >> With best regards, >> Dmitry Koval >> >> Postgres Professional: http://postgrespro.com > > Hi, > For v12-0001-PGPRO-ALTER-TABLE-MERGE-PARTITIONS-command.patch: > > + if (equal(name, cmd->name)) > + /* One new partition can have the same name as merged > partition. */ > + isSameName = true; > > I think there should be a check before assigning true to isSameName - if > isSameName is true, that means there are two partitions with this same name. > > Cheers > Pardon - I see that transformPartitionCmdForMerge() compares the partition names. Maybe you can add a comment in ATExecMergePartitions referring to transformPartitionCmdForMerge() so that people can more easily understand the logic. --00000000000038f6bb05eac56cb3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Tue, Oct 11, 2022 at 9:58 AM Zhiho= ng Yu <zyu@yugabyte.com> wrot= e:


On Tue, Oct 11, 2022 at 9:22 AM Dmitry Koval <<= a href=3D"mailto:d.koval@postgrespro.ru" target=3D"_blank">d.koval@postgres= pro.ru> wrote:
Hi!

Fixed couple warnings (for cfbot).

--
With best regards,
Dmitry Koval

Postgres Professional: http://postgrespro.com
Hi,
For=C2=A0v12-0001-PGPRO-ALTER-TABLE-MERGE-PARTITIONS-command.patch:

+ =C2=A0 =C2=A0 =C2=A0 if (equal(name, cmd->name))
+ = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* One new partition can have the same n= ame as merged partition. */
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 is= SameName =3D true;

I think there should be a check= before assigning true to isSameName - if isSameName is true, that means th= ere are two partitions with this same name.

Cheers= =C2=A0

Pardon - I see tha= t=C2=A0transformPartitionCmdForMerge() compares the partition names.
<= div>Maybe you can add a comment in=C2=A0ATExecMergePartitions referring to = transformPartitionCmdForMerge() so that people can more easily understand t= he logic.
--00000000000038f6bb05eac56cb3--