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 1vDM9c-007LEa-D6 for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Oct 2025 12:16:51 +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 1vDM9b-007btm-D7 for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Oct 2025 12:16:50 +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 1vDM6h-007Y91-Ut for pgsql-hackers@lists.postgresql.org; Mon, 27 Oct 2025 12:13:50 +0000 Received: from mail-io1-xd35.google.com ([2607:f8b0:4864:20::d35]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vDM6f-0041fA-0v for pgsql-hackers@lists.postgresql.org; Mon, 27 Oct 2025 12:13:50 +0000 Received: by mail-io1-xd35.google.com with SMTP id ca18e2360f4ac-93e2d42d9b4so188269339f.2 for ; Mon, 27 Oct 2025 05:13:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761567228; x=1762172028; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=kc1JLBIdEkEOPp5HNSGXi1XQCrOhArt0F21BQYuBBVg=; b=mRYSZQIzJ388JwTZNN18uZI+WRRpdlTwCWU32e9buLlxE2GIcCbCpcWrmGknPhQTL8 cCKg4xRrHPZzeuKGAtrhgc00UpFNdDdvuLj4QTjHxI/qelt3leOrWEhssCp+KABlhlwH c9VMwvUxHZvgRdePGN17gPZu1x97ZiaHVi53XCraC+PLON3SlZ2/ub6A3GecZazTxrOm m1WWDj6s8eNb77Rg22mic8PiEEaGONl8e6ypXmdWaVjGoBMitIXm0s2cse+WCWHE3tRM zTt5ixpJdp19sB6VpKMaqbMtPZyvfizBNhb5KU/9WoVFnAJdNCJihpd3VRuKX8km0Z/Q GCOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761567228; x=1762172028; 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=kc1JLBIdEkEOPp5HNSGXi1XQCrOhArt0F21BQYuBBVg=; b=f1q6CI8z1XrgQ0NQxANmC320wArlggeJRXcJidBcev3eINrUak4lpg+ltAd68t1g6Z bAgot2kyZOUHRC0YMsgI45BizPBfNOOv40N/oHblHkKqe61lkUPqC3GCbu8KKWE80fiU TOoRhjumVud4CUQ4e2VP7PM7mbhQZuanyV6PZCOpe44eSXBDos/oejWqCYKJt+laE9uN DaDSOljyDtqRGo8HiI8Nza6IQvQfn5oSpDB/1WC2RP4k8EPsPVXIbgMZ5GUxNeWVeLmn Z51TaQwhKAVJOSYK1YrZ1JU4rRZnE9EPHP/KNAoV/C2hwUxpfpCJ34pPbjG8s9YTklMD AbvA== X-Forwarded-Encrypted: i=1; AJvYcCVtTEDijJXu/YT/lYHPTN44UoLl6J4wKjl7xmOnyOS3V7hr2TigzrWo+NH8i8WFiqhqfvGkG5siON9HyMtG@lists.postgresql.org X-Gm-Message-State: AOJu0Yx7jiL0gg6FPYWT5tn+N4+0032Q9IsAtpf2sp/s+MBp6eLovjUD pcJvqzoo5wEiTUlOSCMfSrVC54M7WqyDoY1Eprm9CmD7m9HlLbcApxu1uc3MPjjajRlfirFQ6eN 3ehUjfAegHrQrtjDItd6xgTXkQCFi1ak= X-Gm-Gg: ASbGncswymU+3/tucUYwF8YlXFGVKntzClPulo2goJh5FsfUqHNzuzoxaqvw8VMMlZl YMBvf2ynHrmSXwi1ZCwDZnlG/eocv9WjxuKmQHc+kxm+JX/Rk/taxGGvclQm/zpmVJHrrZQg5Mv 1pbUeei+LloVAQ+SSd9XAfuMDmOdF3WKJ4ka7U61PHE/obT93lT6FjJVfaILgpDw9Z7YXDcCGsp jhUfZr4Naow1OUYAeEE5AjzbCujKIgC75v9CZ0ljiC/uD/PyJpK4tSTpdFq9/7JSJAvSazY01tl GRrq7ojC69rjPymV97JqEud7Dygbmn+qeyzKuRX0Bts89yio5a9yhEy2F5E8wX1yP3sgJg== X-Google-Smtp-Source: AGHT+IGukvESe6JIt2XXBpVVpU8+5Hs3dVuZCRx2OvFAIPJZ3wwQJmsO5Lk96W3A5Br2bss8PNkoRpLseizE6PJEcpo= X-Received: by 2002:a05:6e02:1d9d:b0:42f:9b7b:bb7e with SMTP id e9e14a558f8ab-430c52d535amr479994035ab.25.1761567228370; Mon, 27 Oct 2025 05:13:48 -0700 (PDT) MIME-Version: 1.0 References: <171085360143.2046436.7217841141682511557.pgcf@coridan.postgresql.org> <2643645f-2a02-43de-9321-c995ab1b7ef8@postgrespro.ru> <57a94d8a-d7b6-4c5e-9001-be1cd403b172@postgrespro.ru> <54414932-9E82-47AA-902B-2DED18F07F64@gmail.com> <3280c458-a886-4c58-8e2b-4d220b73161d@postgrespro.ru> In-Reply-To: From: Alexander Korotkov Date: Mon, 27 Oct 2025 14:13:36 +0200 X-Gm-Features: AWmQ_bleKAUWeG-960J1wOEjgnDu9yZloxX7Yxti2lr4q_hyuCSBB0BJOFCvv_k Message-ID: Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands To: Dmitry Koval Cc: jian he , pgsql-hackers@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000e52324064222d41f" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000e52324064222d41f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Sep 22, 2025 at 11:12=E2=80=AFPM Dmitry Koval wrote: > Hi, Jiah He! > > 1. > >duplicated CommandCounterIncrement call? > > Probably this duplication is necessary to rename partition correctly ... > The second CommandCounterIncrement() is needed to make the renamed relation visible within our transaction. Why do we need the first one? I see tests pass without it. Also, I doubt this is correct in the partitions_listdatum_intersection() function. foreach_node(Const, val1, list1) { if (val1->constisnull) { if (isnull2) { result =3D lappend(result, val1); return result; } isnull1 =3D true; continue; } The branch handling null value in the outer loop, uses null2 flag from the inner loop. I think for the null value of the outer loop we still need to run inner loop to search for the matching null value. ------ Regards, Alexander Korotkov Supabase --000000000000e52324064222d41f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Mon, Sep 22, 2025 at 11:12=E2=80= =AFPM Dmitry Koval <d.koval@po= stgrespro.ru> wrote:
Hi, Jiah He!=

1.
=C2=A0>duplicated CommandCounterIncrement call?

Probably this duplication is necessary to rename partition correctly ...

The second CommandCounterIncrement() is n= eeded to make the renamed relation visible within our transaction.=C2=A0 Wh= y do we need the first one?=C2=A0 I see tests pass without it.
Also, I doubt this is correct in the=C2=A0partitions_list= datum_intersection() function.

=C2=A0 =C2=A0 foreach_node(Const, val1, list1)
=C2=A0 =C2=A0 {
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (val1->constisnull)
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (isnull2)
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 result =3D lappend(result, val1);
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return result;
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 isnull1 =3D true;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 continue= ;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }

The = branch handling null value in the outer loop, uses null2 flag from the inne= r loop.=C2=A0 I think for the null value of the outer loop we still need to= run inner loop to search for the matching null value.

=
------
Regards,
Alexander Korotkov
Supabase
<= /div>
--000000000000e52324064222d41f--