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 1s0syf-007wym-FS for pgsql-hackers@arkaria.postgresql.org; Sun, 28 Apr 2024 01:05:13 +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 1s0syc-00BSDr-4I for pgsql-hackers@arkaria.postgresql.org; Sun, 28 Apr 2024 01:05:11 +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.94.2) (envelope-from ) id 1s0syb-00BSDj-P8 for pgsql-hackers@lists.postgresql.org; Sun, 28 Apr 2024 01:05:10 +0000 Received: from mail-yb1-xb2d.google.com ([2607:f8b0:4864:20::b2d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1s0syZ-000QoM-J6 for pgsql-hackers@lists.postgresql.org; Sun, 28 Apr 2024 01:05:10 +0000 Received: by mail-yb1-xb2d.google.com with SMTP id 3f1490d57ef6-de5b1e6beceso1987545276.0 for ; Sat, 27 Apr 2024 18:05:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714266306; x=1714871106; 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=i++gHZifCNknceTPbPEVAb1meoOOkyJWXviC/tYFPmk=; b=lDg9SjNf1uYoXoan0LIRyN23Tg73Bv/8v2Ntm89YLxbEsfFobHDntJj2lHAVCnAGVq FZrDZ1b/HI7VZa6uCfrVigxmi4bLV91h7zWobcgq9OUIS/1Dm5rRKD1d1VpkQKffE1Zf VRTLPDLGCXDbRo5jW3A3IyctwEmA4jyULihldD9/pLJ8G3FfjUZvebgrPjPNUgfg9daL sBkTFjUBY87zJrZO7/BSfp2Z/6/y0ag7pD76Rrw4qYDWl1AJCKW6FZjeEzia7PhZtA60 7RpvsI9Z/N5vrS5Letv0bBOgZQFxQhIzmZ2wJ6fF3tP1oBazGgP7mAFL5iB3RNlUNDEG DZwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714266306; x=1714871106; 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=i++gHZifCNknceTPbPEVAb1meoOOkyJWXviC/tYFPmk=; b=oAhd0kFIkw3FQLTuarma3LiS3uekB+gI2oq6pxt4k4rn40PChpaVFE3JssFYhGynsY iKWkx3wjvY2Dp6G+O9tvq5fVU1qdajra50FD8VtduUND9JgnDEpNFHkfc0wNkd4duB90 QTmnMFQMmtcvoocL7xFcnHF0bKEvzDuJ59y1+1Ef4XqcJUTVtWFrwC5h2o1D+20TItEm CFvY/Lh2vbusjSEGbs94RingMI0nNLDzqVlGHqVsTcIQAjpzgL/gzg6K9CN7QwH0jvOQ JrkRpY6t8hvVT7mqEIUS47+2Nk+zqzh+4xEyBXr4om6Lhq5hwqowyfLYS6DSu/5KUsl0 x0fA== X-Forwarded-Encrypted: i=1; AJvYcCXwqO3bpD6WvIJWhdzfna6svq65xFhCJYFIV3EGUQXekidAU7FyDuzIgi4L8B1dloyoND0fKtFO1v/8MyGvAHeWomLSV/kJo2fMCrhQGG+a4WEO X-Gm-Message-State: AOJu0YxSo4zgJlzCzCUavSfz/TgBNuUiWi/BHPHNcWoLfed9CoDmdpa8 sEQC2wZqzAvyMn7CpJqO3T7kIPvJfAmRcut+k6DnZA1vjQjZvOPYbiPIltowlPfU4LkvzolshcK 1JXFdOj+7/eItrqCVTQGeL32/WD3EVtlI X-Google-Smtp-Source: AGHT+IGYvwG4ftcQ+NSPRUrn+65DULfqutV+eA1ilrL/hWMh4DN0KF+KghlmWgnyTlInEi0bSbbBMEdBq391nqruWFw= X-Received: by 2002:a25:9cc7:0:b0:de5:5919:c9e5 with SMTP id z7-20020a259cc7000000b00de55919c9e5mr6792351ybo.43.1714266305780; Sat, 27 Apr 2024 18:05:05 -0700 (PDT) MIME-Version: 1.0 References: <56e0000c-6b39-44ce-90b4-d3c3062e408c@postgrespro.ru> <5dee3937-8e9f-cca4-11fb-737709a92b37@gmail.com> In-Reply-To: From: Alexander Korotkov Date: Sun, 28 Apr 2024 04:04:54 +0300 Message-ID: Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands To: Justin Pryzby Cc: Dmitry Koval , Alexander Lakhin , Robert Haas , 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 Hi Justin, Thank you for your review. Please check v9 of the patchset [1]. On Wed, Apr 24, 2024 at 11:26=E2=80=AFPM Justin Pryzby wrote: > This patch also/already fixes the schema issue I reported. Thanks. > > If you wanted to include a test case for that: > > begin; > CREATE SCHEMA s; > CREATE SCHEMA t; > CREATE TABLE p(i int) PARTITION BY RANGE(i); > CREATE TABLE s.c1 PARTITION OF p FOR VALUES FROM (1)TO(2); > CREATE TABLE s.c2 PARTITION OF p FOR VALUES FROM (2)TO(3); > ALTER TABLE p MERGE PARTITIONS (s.c1, s.c2) INTO s.c1; -- misbehaves if m= erging into the same name as an existing partition > \d+ p > ... > Partitions: c1 FOR VALUES FROM (1) TO (3) There is already a test which checks merging into the same name as an existing partition. And there are tests with schema-qualified names. I'm not yet convinced we need a test with both these properties together. > > 0002 > > The persistence of the new partition is copied as suggested in [1]. > > But the checks are in-place, because search_path could influence new > > table persistence. Per review [2], commit message typos are fixed, > > documentation is revised, revised tests to cover schema-qualification, > > usage of search_path. > > Subject: [PATCH v8 2/7] Make new partitions with parent's persistence dur= ing MERGE/SPLIT operations > > This patch adds documentation saying: > + Any indexes, constraints and user-defined row-level triggers that = exist > + in the parent table are cloned on new partitions [...] > > Which is good to say, and addresses part of my message [0] > [0] ZiJW1g2nbQs9ekwK@pryzbyj2023 > > But it doesn't have anything to do with "creating new partitions with > parent's persistence". Maybe there was a merge conflict and the docs > ended up in the wrong patch ? Makes sense. Extracted this into a separate patch in v10. > Also, defaults, storage options, compression are also copied. As will > be anything else from LIKE. And since anything added in the future will > also be copied, maybe it's better to just say that the tables will be > created the same way as "LIKE .. INCLUDING ALL EXCLUDING ..", or > similar. Otherwise, the next person who adds a new option for LIKE > would have to remember to update this paragraph... Reworded that way. Thank you. > Also, extended stats objects are currently cloned to new child tables. > But I suggested in [0] that they probably shouldn't be. I will explore this. Do we copy extended stats when we do CREATE TABLE ... PARTITION OF? I think we need to do the same here. > > 007 =E2=80=93 doc review by Justin [3] > > I suggest to drop this patch for now. I'll send some more minor fixes to > docs and code comments once the other patches are settled. Your edits are welcome. Dropped this for now. And waiting for the next revision from you. Links. 1. https://www.postgresql.org/message-id/CAPpHfduYuYECrqpHMgcOsNr%2B4j3uJK%= 2BJPUJ_zDBn-tqjjh3p1Q%40mail.gmail.com ------ Regards, Alexander Korotkov Supabase