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.96) (envelope-from ) id 1wFDTy-004qlW-21 for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Apr 2026 15:57:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wFDTx-009gCR-2y for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Apr 2026 15:57:49 +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.96) (envelope-from ) id 1wFDTx-009gCI-27 for pgsql-hackers@lists.postgresql.org; Tue, 21 Apr 2026 15:57:49 +0000 Received: from mail-ot1-x32b.google.com ([2607:f8b0:4864:20::32b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wFDTv-00000002K0w-2YvG for pgsql-hackers@postgresql.org; Tue, 21 Apr 2026 15:57:49 +0000 Received: by mail-ot1-x32b.google.com with SMTP id 46e09a7af769-7dcdd23fcdfso319580a34.3 for ; Tue, 21 Apr 2026 08:57:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1776787066; cv=none; d=google.com; s=arc-20240605; b=fuikczkChXeac5GkC2MHkOzbSyJqo1kST4w1E3ahMvB8g2QynsadWcPa22cPdv81gg svMxKwexLzykvHkIHFKbupoofB0m84VvZZ/S8y9yQcuKM5AyaIQAaPKnox1xN/L2Cp+k dxPLddhQ+gg9kBiS3P9oxyU+/iJmeLgxiMvkTmx8AlXgg3OQcDMapX5QxQ17N4If3DPm h55EDPAEd3kJ0pp9MqXhV4Y6OTTl/QmrTG9gWSQ00+PU8Bs8E14NL0a9THdRuBBeiU3E owpcdkA2dplrRp6HNjd342+jY0KcQCoIklV+Ru8rDCwIUVltb7CXGCW10THqozQpEbIn f9mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=vyFC+uHKbT8H7+C2MTg6OWdvbbkltLzuW6cRL5kk9PM=; fh=zplfUrc9U/W40oqhlOtIftZ2fMKLI8L9bJ+re1ugQl0=; b=K3cQsCL2dw78T7XMXaeour4xO/p6wWWHY14grDCaTdC1ufqZOnVXoSITGUtvmaftMs ndh5PC/SZPrhrPMEScrasxh7PEbANVCvO/jgYhC+tQZvGR2hUaiv3qfRjS7/KPQmxAh7 DcvDiHy6KJqDNLNioAwCW83xhcM49i20Apn9PWWiUgkgF+ROUf05YqdhXgFohVr0ABpj qw4vjOtUP21dWEnSCVNRJOrRP0rQ9nPCyPp5PbRk8VmFtUojpjnF3pLT5Cjg+sN/xODF ZmtbDaKAS+bn8MNEmCsNSs6syBnRGHYYyiqeMYyuFTdfC42qVo6GxVUa9fS2VlsMaAMu m3UQ==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776787066; x=1777391866; darn=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=vyFC+uHKbT8H7+C2MTg6OWdvbbkltLzuW6cRL5kk9PM=; b=M4pIrnGnSLQ/TpclxSNWElxJUHmHuWDSQdfVaH9yuaeWwQCmc7OzLrW+6LJKu/8pJe ViVC/lA9o9X2nYCugddzOElhrYDlCmyRwBW0unXwM3dMszSlVh65ihLjqezhJofQt5jC bCNl4AM0FSxMCDl8fTwcG7e4HmwhC2MUggpJIJYFJVPoELgFtEnRArxP2rev0BzZqwCR LeMbZToAEmzG0N/DGsqevF/DzparE64xRWtviSbh3hAIxVE5V9ida7A0YY/YeSXwohft SiL423dV0TJbUu12xN10k9iDsxX+g078yCa0c0EGKDv6kXVhr+WdAM37L1NgqxoyARQ6 Ue1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776787066; x=1777391866; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=vyFC+uHKbT8H7+C2MTg6OWdvbbkltLzuW6cRL5kk9PM=; b=D882ugexHYjd3RwI9SWRFPv9voM1r7Ay1PijN3bsKrzGXUUAqC7oDX08dhCD8HamAy tDLCpFfhqpCLgIGHXd7NECRz1Hvz35LODw3wpPKf73V08NSRhUiaAcIOwUHViN4y6vRw OhbxFivqzkuPZIh5UTOKSFM410anNqgk4sHv7VyCCqdOPrEpTvPTxnlJYS5HHl3pyiqv WRJfPgQ81/M4hk4m/Te1g4FBa9c5SiYWAotvNJaiHr4Flx67B6v0qrUGCHCE0MADouw1 +PnOuxqPpMmzF2BGEoFlJumULWxpasRmTIgGEpZilTfRW+maFcmic0c1DIC2JMYqtbOC /GuQ== X-Forwarded-Encrypted: i=1; AFNElJ/eL4UiTCqBYCmJvS4qvdoJmArq+isNT8G9wDwFqHcOGjg3f8ql187uBbwS0S10W24xy2RTAx/TDI0pnOAT@postgresql.org X-Gm-Message-State: AOJu0YyR5KB+Ma7t6lLaErhKb/4kAFGgy3tsMFY2RErDzkZzFaZwk3B6 rLcRTeNWbMNm1ySxA/BGZIdoMjkYA3OjqDwV47kMMxzgyNhdrwYcXkNq3MFOMQJJWDRrevAOUh5 t69T7GHK8atG3vivt6flAg9VfgHW5iiaTHKsN40E81HDC9TA= X-Gm-Gg: AeBDieuBDJONmCR9ZfpVuxoh0VYQRiEZZfXedUREnPk+ckOIvu1DYIHJzKlmAn6DEBR jtzbP+uEO/Zt1choHY7j0ccU8RZXG4yDGppTQFAs0XTMt+GJvO+78HGTVzU2x6GpKs8SRccfIDb dcMlYeF/Sxn5w5jTqoglRwDVVwyzC2c9l1hse31SUmVvruH1KR71LghETuXIk8OcAfIxu+oGnle w6an+BA8zy8j4J8Qyp77Pv/1fPoBxFvkBv37HA6SYmYMOF8moOI+3e9OXkIlY7UisOBUrSYEMIV qFJw+ttXmS1z0UztoCGmG/3qvbZpPEooWXOpuoWYBSkpRSOJh17vPFF0+hhpTe2W2l/CtzdajWt 3xB9IZEJsbrywAc6F X-Received: by 2002:a05:6820:83d2:20b0:68e:7e21:2245 with SMTP id 006d021491bc7-69462e5e507mr7303997eaf.19.1776787065793; Tue, 21 Apr 2026 08:57:45 -0700 (PDT) MIME-Version: 1.0 References: <31d04a1b-c0cb-4e6f-a344-0db048a3b673@gmail.com> <414c3430-77a9-438e-9dc0-c66033f6be63@postgrespro.ru> In-Reply-To: From: Alexander Korotkov Date: Tue, 21 Apr 2026 18:57:33 +0300 X-Gm-Features: AQROBzDY6nzpdO798wf7HDHuJvU7ujyp3wBlFDDSRwOuJkmKOmylZxh-aHWYcx8 Message-ID: Subject: Re: MERGE PARTITIONS and DEPENDS ON EXTENSION. To: Matheus Alcantara Cc: Dmitry Koval , pgsql-hackers 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! On Tue, Apr 21, 2026 at 4:20=E2=80=AFPM Matheus Alcantara wrote: > On Mon Apr 20, 2026 at 4:08 PM -03, Alexander Korotkov wrote: > > On Thu, Apr 16, 2026 at 9:03=E2=80=AFPM Matheus Alcantara > > wrote: > >> > >> On Tue Apr 14, 2026 at 6:05 AM -03, Dmitry Koval wrote: > >> > Hi Matheus! > >> > > >> > Thank you for patch. > >> > I agree that dependency should be automatically added for SPLIT > >> > PARTITION. But I'm not sure about MERGE PARTITION ... > >> > Might be it would be more correct to automatically add a dependency = only > >> > if all merged partitions have it? > >> > >> Hi, > >> > >> Thank you for taking a look on this! > >> > >> I agree with your suggestion. The attached patch implements the > >> intersection behavior for MERGE PARTITIONS: extension dependencies are > >> only preserved on the merged partition's index if all source partition > >> indexes have that dependency. > >> > >> For example: > >> MERGE(idx1(ext_a, ext_b), idx2(ext_a)) -> idx3(ext_a) -- only ext_a i= s common > >> MERGE(idx1(ext_a), idx2()) -> idx3() -- no common de= ps > > > > This is not obvious for me. I would rather trigger an error if there > > are different dependencies on merging partitions. > > > > Yeah, I agree that this sounds a bit confusing, although this behavior > is documented on the last patch version I think that raising an error is > more simple and maybe is more obvious. The attached patch implement > this. I've spotted the following things in this patch. 1) The equality of dependencies is not fully checked. We only check that for each new dependency, we have the same for previous partition, but not vise versa. 2) The complexity of dependency checking is O(n^2). 3) Usage of citext and other extensions in src/test/regress where they might be not available. I've revised the patch. 1) collectPartitionIndexExtDeps() is rewritten(). Now it works in three phases: collect, sort, compare. The comparison phase requires strict equivalence of dependencies and doesn't depend on the order. The complexity is now O(n * log(n)), which I think is acceptable. 2) PartitionIndexExtDepEntry struct now have indexOid. So, on conflict error contains both partition index names. 3) Tests moved to src/test/modules/test_extensions/sql/test_extdepend.sql where test_ext3/test_ext5 extensions are available. 4) More tests for different scenarios. Could you, please, review this changes? ------ Regards, Alexander Korotkov Supabase